update smithay, iced; reworked window for xwayland

This commit is contained in:
Victoria Brekenfeld 2023-01-16 15:12:25 +01:00
parent 47dfc85314
commit 7992ad67f6
27 changed files with 2285 additions and 1106 deletions

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
use crate::{utils::prelude::*, wayland::protocols::screencopy::SessionType};
use crate::{shell::CosmicSurface, utils::prelude::*, wayland::protocols::screencopy::SessionType};
use smithay::{
delegate_xdg_shell,
desktop::{
@ -39,7 +39,7 @@ impl XdgShellHandler for State {
fn new_toplevel(&mut self, surface: ToplevelSurface) {
let seat = self.common.last_active_seat().clone();
let window = Window::new(surface);
let window = CosmicSurface::Wayland(Window::new(surface));
self.common.shell.toplevel_info_state.new_toplevel(&window);
self.common.shell.pending_windows.push((window, seat));
// We will position the window after the first commit, when we know its size hints
@ -149,7 +149,7 @@ impl XdgShellHandler for State {
let output = seat.active_output();
let (window, _) = mapped
.windows()
.find(|(w, _)| w.toplevel() == &surface)
.find(|(w, _)| w.wl_surface().as_ref() == Some(surface.wl_surface()))
.unwrap();
if let Some(grab) =
workspace.move_request(&window, &seat, &output, serial, start_data)
@ -213,7 +213,7 @@ impl XdgShellHandler for State {
if let Some(workspace) = self.common.shell.space_for_mut(&mapped) {
let (window, _) = mapped
.windows()
.find(|(w, _)| w.toplevel() == &surface)
.find(|(w, _)| w.wl_surface().as_ref() == Some(surface.wl_surface()))
.unwrap();
workspace.maximize_request(&window, &output)
}
@ -230,9 +230,9 @@ impl XdgShellHandler for State {
if let Some(workspace) = self.common.shell.space_for_mut(&mapped) {
let (window, _) = mapped
.windows()
.find(|(w, _)| w.toplevel() == &surface)
.find(|(w, _)| w.wl_surface().as_ref() == Some(surface.wl_surface()))
.unwrap();
workspace.unmaximize_request(&window)
workspace.unmaximize_request(&window);
}
}
}
@ -255,7 +255,7 @@ impl XdgShellHandler for State {
if let Some(workspace) = self.common.shell.space_for_mut(&mapped) {
let (window, _) = mapped
.windows()
.find(|(w, _)| w.toplevel() == &surface)
.find(|(w, _)| w.wl_surface().as_ref() == Some(surface.wl_surface()))
.unwrap();
workspace.fullscreen_request(&window, &output)
}
@ -272,7 +272,7 @@ impl XdgShellHandler for State {
if let Some(workspace) = self.common.shell.space_for_mut(&mapped) {
let (window, _) = mapped
.windows()
.find(|(w, _)| w.toplevel() == &surface)
.find(|(w, _)| w.wl_surface().as_ref() == Some(surface.wl_surface()))
.unwrap();
workspace.unfullscreen_request(&window)
}

View file

@ -3,7 +3,8 @@
use crate::{shell::Shell, utils::prelude::*};
use smithay::{
desktop::{
layer_map_for_output, LayerSurface, PopupKind, PopupManager, Window, WindowSurfaceType,
layer_map_for_output, space::SpaceElement, LayerSurface, PopupKind, PopupManager, Window,
WindowSurfaceType,
},
output::Output,
reexports::{
@ -15,6 +16,7 @@ use smithay::{
utils::{Logical, Point, Rectangle},
wayland::{
compositor::{get_role, with_states},
seat::WaylandFocus,
shell::xdg::{
PopupSurface, PositionerState, SurfaceCachedState, XdgPopupSurfaceRoleAttributes,
XDG_POPUP_ROLE,
@ -31,12 +33,12 @@ impl Shell {
let element_geo = workspace.element_geometry(elem).unwrap();
let (window, offset) = elem
.windows()
.find(|(w, _)| w.toplevel().wl_surface() == &parent)
.find(|(w, _)| w.wl_surface().as_ref() == Some(&parent))
.unwrap();
let window_geo_offset = window.geometry().loc;
let window_loc = element_geo.loc + offset + window_geo_offset;
let anchor_point = get_anchor_point(&positioner) + window_loc;
if elem.is_tiled() {
if elem.is_tiled().unwrap() {
if !unconstrain_xdg_popup_tile(surface, element_geo) {
if let Some(output) = workspace.output_under(anchor_point) {
unconstrain_xdg_popup(surface, window_loc, output.geometry());