tiling: Recalculate when unmaximizing

This commit is contained in:
Victoria Brekenfeld 2023-05-30 16:32:58 +02:00
parent 9531b3798e
commit 6d270dec14
2 changed files with 9 additions and 1 deletions

View file

@ -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!();

View file

@ -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);