From 10c196a08041b34a795f3be4a3f7083605fb24f7 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Wed, 20 Dec 2023 20:32:10 +0000 Subject: [PATCH] shell: Lift recalculate to consider sticky_layer --- src/shell/mod.rs | 7 +++++++ src/wayland/handlers/compositor.rs | 4 +--- src/wayland/handlers/layer_shell.rs | 4 +--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/shell/mod.rs b/src/shell/mod.rs index 134a2764..b870d447 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -795,6 +795,13 @@ impl Workspaces { self.refresh(workspace_state, toplevel_info_state, xdg_activation_state) } + pub fn recalculate(&mut self) { + for set in self.sets.values_mut() { + set.sticky_layer.refresh(); + set.workspaces.iter_mut().for_each(|w| w.recalculate()); + } + } + pub fn refresh( &mut self, workspace_state: &mut WorkspaceUpdateGuard<'_, State>, diff --git a/src/wayland/handlers/compositor.rs b/src/wayland/handlers/compositor.rs index 7e0a9c04..f3724dd6 100644 --- a/src/wayland/handlers/compositor.rs +++ b/src/wayland/handlers/compositor.rs @@ -252,9 +252,7 @@ impl CompositorHandler for State { if let Some(output) = layer_output { let changed = layer_map_for_output(&output).arrange(); if changed { - for workspace in self.common.shell.workspaces.spaces_mut() { - workspace.recalculate(); - } + self.common.shell.workspaces.recalculate(); } } diff --git a/src/wayland/handlers/layer_shell.rs b/src/wayland/handlers/layer_shell.rs index 70acd77a..957a732b 100644 --- a/src/wayland/handlers/layer_shell.rs +++ b/src/wayland/handlers/layer_shell.rs @@ -74,9 +74,7 @@ impl WlrLayerShellHandler for State { map.unmap_layer(&layer); } - for workspace in self.common.shell.workspaces.spaces_mut() { - workspace.recalculate(); - } + self.common.shell.workspaces.recalculate(); // collect screencopy sessions needing an update let mut scheduled_sessions = self.schedule_workspace_sessions(surface.wl_surface());