diff --git a/src/shell/mod.rs b/src/shell/mod.rs index a5971ee2..95690e8f 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -1697,6 +1697,18 @@ impl Shell { .refresh(Some(&self.workspace_state)); } + pub fn on_commit(&mut self, surface: &WlSurface) { + if let Some(mapped) = self.element_for_surface(surface) { + mapped + .windows() + .find(|(w, _)| w.wl_surface().as_ref() == Some(surface)) + .unwrap() + .0 + .on_commit(); + } + self.popups.commit(surface); + } + pub fn remap_unfullscreened_window( &mut self, mapped: CosmicMapped, diff --git a/src/shell/workspace.rs b/src/shell/workspace.rs index 86436185..9e5b1f07 100644 --- a/src/shell/workspace.rs +++ b/src/shell/workspace.rs @@ -33,10 +33,10 @@ use smithay::{ glow::{GlowFrame, GlowRenderer}, ImportAll, ImportMem, Renderer, }, - desktop::{layer_map_for_output, space::SpaceElement, WindowSurfaceType}, + desktop::{layer_map_for_output, space::SpaceElement}, input::Seat, output::Output, - reexports::wayland_server::{protocol::wl_surface::WlSurface, Client, Resource}, + reexports::wayland_server::{Client, Resource}, utils::{Buffer as BufferCoords, IsAlive, Logical, Physical, Point, Rectangle, Scale, Size}, wayland::{ compositor::{add_blocker, Blocker, BlockerState}, @@ -360,29 +360,6 @@ impl Workspace { clients } - pub fn commit(&mut self, surface: &WlSurface) { - if let Some(mapped) = self.element_for_surface(surface) { - mapped - .windows() - .find(|(w, _)| w.wl_surface().as_ref() == Some(surface)) - .unwrap() - .0 - .on_commit(); - } - if let Some(mapped) = self.minimized_windows.iter().find_map(|m| { - m.window - .has_surface(surface, WindowSurfaceType::TOPLEVEL) - .then_some(&m.window) - }) { - mapped - .windows() - .find(|(w, _)| w.wl_surface().as_ref() == Some(surface)) - .unwrap() - .0 - .on_commit(); - } - } - pub fn output(&self) -> &Output { &self.output } diff --git a/src/wayland/handlers/compositor.rs b/src/wayland/handlers/compositor.rs index 02e122d8..3465ca86 100644 --- a/src/wayland/handlers/compositor.rs +++ b/src/wayland/handlers/compositor.rs @@ -242,14 +242,11 @@ impl CompositorHandler for State { element.clone(), &mut self.common.shell, ); - if let Some(workspace) = self.common.shell.space_for_mut(&element) { - workspace.commit(surface); - } } } // and refresh smithays internal state - self.common.shell.popups.commit(surface); + self.common.shell.on_commit(surface); // re-arrange layer-surfaces (commits may change size and positioning) let layer_output = self