shell: Send on_commit to sticky windows as well

This commit is contained in:
Victoria Brekenfeld 2024-03-28 13:10:28 +01:00
parent b371a26362
commit 6416299d58
3 changed files with 15 additions and 29 deletions

View file

@ -1697,6 +1697,18 @@ impl Shell {
.refresh(Some(&self.workspace_state)); .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( pub fn remap_unfullscreened_window(
&mut self, &mut self,
mapped: CosmicMapped, mapped: CosmicMapped,

View file

@ -33,10 +33,10 @@ use smithay::{
glow::{GlowFrame, GlowRenderer}, glow::{GlowFrame, GlowRenderer},
ImportAll, ImportMem, Renderer, ImportAll, ImportMem, Renderer,
}, },
desktop::{layer_map_for_output, space::SpaceElement, WindowSurfaceType}, desktop::{layer_map_for_output, space::SpaceElement},
input::Seat, input::Seat,
output::Output, 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}, utils::{Buffer as BufferCoords, IsAlive, Logical, Physical, Point, Rectangle, Scale, Size},
wayland::{ wayland::{
compositor::{add_blocker, Blocker, BlockerState}, compositor::{add_blocker, Blocker, BlockerState},
@ -360,29 +360,6 @@ impl Workspace {
clients 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 { pub fn output(&self) -> &Output {
&self.output &self.output
} }

View file

@ -242,14 +242,11 @@ impl CompositorHandler for State {
element.clone(), element.clone(),
&mut self.common.shell, &mut self.common.shell,
); );
if let Some(workspace) = self.common.shell.space_for_mut(&element) {
workspace.commit(surface);
}
} }
} }
// and refresh smithays internal state // 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) // re-arrange layer-surfaces (commits may change size and positioning)
let layer_output = self let layer_output = self