diff --git a/src/shell/element/surface.rs b/src/shell/element/surface.rs index 0c0c2e70..570dd946 100644 --- a/src/shell/element/surface.rs +++ b/src/shell/element/surface.rs @@ -182,6 +182,21 @@ impl CosmicSurface { } } + pub fn last_server_size(&self) -> Option> { + match self.0.underlying_surface() { + WindowSurface::Wayland(toplevel) => with_states(toplevel.wl_surface(), |states| { + let attributes = states + .data_map + .get::() + .unwrap() + .lock() + .unwrap(); + attributes.current_server_state().size + }), + WindowSurface::X11(_) => None, + } + } + 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 01fcb3f0..882df294 100644 --- a/src/shell/layout/floating/mod.rs +++ b/src/shell/layout/floating/mod.rs @@ -686,6 +686,8 @@ impl FloatingLayout { && let Some(pending_size) = window.pending_size() { mapped_geometry.size = pending_size.as_local(); + } else if let Some(server_size) = window.active_window().last_server_size() { + mapped_geometry.size = server_size.as_local(); } *window.last_geometry.lock().unwrap() = Some(mapped_geometry); }