layout/floating: allow size altering if window was maximized (#2038)

This commit is contained in:
Salvatore Gabriele La Greca 2026-03-27 11:56:34 +01:00 committed by GitHub
parent 06ece0fdcd
commit 9ad5c916f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View file

@ -182,6 +182,21 @@ impl CosmicSurface {
}
}
pub fn last_server_size(&self) -> Option<Size<i32, Logical>> {
match self.0.underlying_surface() {
WindowSurface::Wayland(toplevel) => with_states(toplevel.wl_surface(), |states| {
let attributes = states
.data_map
.get::<XdgToplevelSurfaceData>()
.unwrap()
.lock()
.unwrap();
attributes.current_server_state().size
}),
WindowSurface::X11(_) => None,
}
}
pub fn global_geometry(&self) -> Option<Rectangle<i32, Global>> {
*self
.0

View file

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