From 612ff2f523580af2729cc7de1e73c334ea135726 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Tue, 16 Dec 2025 18:57:30 -0800 Subject: [PATCH] layout/floating: In `unmap`, don't alter size if no pending changes If the intent here was that the `if let` would only handle the case where there are pending changes, then something like this should be right. Seems to fix behavior in https://github.com/pop-os/cosmic-comp/issues/1819. https://github.com/pop-os/cosmic-comp/issues/1645 may be the same issue. --- src/shell/element/surface.rs | 7 +++++++ src/shell/layout/floating/mod.rs | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/shell/element/surface.rs b/src/shell/element/surface.rs index 6fa5bbed..a1b5c5de 100644 --- a/src/shell/element/surface.rs +++ b/src/shell/element/surface.rs @@ -175,6 +175,13 @@ impl CosmicSurface { } } + pub fn has_pending_changes(&self) -> bool { + match self.0.underlying_surface() { + WindowSurface::Wayland(toplevel) => toplevel.has_pending_changes(), + WindowSurface::X11(_surface) => false, + } + } + pub fn global_geometry(&self) -> Option> { *self .0 diff --git a/src/shell/layout/floating/mod.rs b/src/shell/layout/floating/mod.rs index ae29e604..5a440e0d 100644 --- a/src/shell/layout/floating/mod.rs +++ b/src/shell/layout/floating/mod.rs @@ -679,8 +679,10 @@ impl FloatingLayout { mapped_geometry.size = last_size; } } else if !window.is_maximized(true) { - if let Some(pending_size) = window.pending_size() { - mapped_geometry.size = pending_size.as_local(); + if window.active_window().has_pending_changes() { + if let Some(pending_size) = window.pending_size() { + mapped_geometry.size = pending_size.as_local(); + } } *window.last_geometry.lock().unwrap() = Some(mapped_geometry); }