From 6d270dec14d31ce25f47709267c56ec2b37185f2 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Tue, 30 May 2023 16:32:58 +0200 Subject: [PATCH] tiling: Recalculate when unmaximizing --- src/shell/layout/tiling/mod.rs | 7 +++++++ src/shell/workspace.rs | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/shell/layout/tiling/mod.rs b/src/shell/layout/tiling/mod.rs index 1c438a1c..c90b8036 100644 --- a/src/shell/layout/tiling/mod.rs +++ b/src/shell/layout/tiling/mod.rs @@ -1050,6 +1050,13 @@ impl TilingLayout { } } + pub fn recalculate(&mut self, output: &Output) { + let Some(queue) = self.queues.get_mut(output) else { return }; + let mut tree = queue.trees.back().unwrap().0.copy_clone(); + let blocker = TilingLayout::update_positions(&output, &mut tree, self.gaps); + queue.push_tree(tree, blocker); + } + pub fn refresh(&mut self) { #[cfg(feature = "debug")] puffin::profile_function!(); diff --git a/src/shell/workspace.rs b/src/shell/workspace.rs index a6278d3b..4f117fc6 100644 --- a/src/shell/workspace.rs +++ b/src/shell/workspace.rs @@ -294,10 +294,11 @@ impl Workspace { } pub fn unfullscreen_request(&mut self, window: &CosmicSurface) { - if self.fullscreen.values().any(|w| w == window) { + if let Some((output, _)) = self.fullscreen.iter().find(|(_, w)| *w == window) { window.set_maximized(false); window.set_fullscreen(false); self.floating_layer.refresh(); + self.tiling_layer.recalculate(output); self.tiling_layer.refresh(); window.send_configure(); self.fullscreen.retain(|_, w| w != window);