From 1868f6b0f76bbfd95c651f19df8f8bf3034d0ede Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Thu, 13 Jul 2023 17:40:49 +0200 Subject: [PATCH] shell: Recalculate tiling-layer when layer-shell updates --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/shell/mod.rs | 9 +++++++-- src/wayland/handlers/compositor.rs | 23 +++++++++++++++++------ src/wayland/handlers/layer_shell.rs | 4 ++++ 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1d8b9473..005a3e36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3734,7 +3734,7 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "smithay" version = "0.3.0" -source = "git+https://github.com/smithay//smithay?rev=901f64d01e#901f64d01e3dc4ed7448884b821748dbb1ab5455" +source = "git+https://github.com/smithay//smithay?rev=b401646560#b401646560c43cc65f31a0731efe6b963c9d3e61" dependencies = [ "appendlist", "ash", diff --git a/Cargo.toml b/Cargo.toml index 9b082fb3..02227c8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,4 +80,4 @@ debug = true lto = "fat" [patch."https://github.com/Smithay/smithay.git"] -smithay = { git = "https://github.com/smithay//smithay", rev = "901f64d01e" } +smithay = { git = "https://github.com/smithay//smithay", rev = "b401646560" } diff --git a/src/shell/mod.rs b/src/shell/mod.rs index bc6bc931..756ed9c6 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -1394,8 +1394,13 @@ impl Shell { }) }; - let mut map = layer_map_for_output(&output); - map.map_layer(&layer_surface).unwrap(); + { + let mut map = layer_map_for_output(&output); + map.map_layer(&layer_surface).unwrap(); + } + for workspace in state.common.shell.workspaces.spaces_mut() { + workspace.tiling_layer.recalculate(&output); + } if wants_focus { Shell::set_focus(state, Some(&layer_surface.into()), &seat, None) diff --git a/src/wayland/handlers/compositor.rs b/src/wayland/handlers/compositor.rs index 37b87b5e..5eed36a6 100644 --- a/src/wayland/handlers/compositor.rs +++ b/src/wayland/handlers/compositor.rs @@ -237,12 +237,23 @@ impl CompositorHandler for State { self.common.shell.popups.commit(surface); // re-arrange layer-surfaces (commits may change size and positioning) - if let Some(output) = self.common.shell.outputs().find(|o| { - let map = layer_map_for_output(o); - map.layer_for_surface(surface, WindowSurfaceType::ALL) - .is_some() - }) { - layer_map_for_output(output).arrange(); + let layer_output = self + .common + .shell + .outputs() + .find(|o| { + let map = layer_map_for_output(o); + map.layer_for_surface(surface, WindowSurfaceType::ALL) + .is_some() + }) + .cloned(); + 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.tiling_layer.recalculate(&output); + } + } } let mut scheduled_sessions = self.schedule_workspace_sessions(surface); diff --git a/src/wayland/handlers/layer_shell.rs b/src/wayland/handlers/layer_shell.rs index 2083d541..febf8c65 100644 --- a/src/wayland/handlers/layer_shell.rs +++ b/src/wayland/handlers/layer_shell.rs @@ -75,6 +75,10 @@ impl WlrLayerShellHandler for State { map.unmap_layer(&layer); } + for workspace in self.common.shell.workspaces.spaces_mut() { + workspace.tiling_layer.recalculate(&output); + } + // collect screencopy sessions needing an update let mut scheduled_sessions = self.schedule_workspace_sessions(surface.wl_surface()); if let Some(sessions) = output.user_data().get::() {