From 9962fa7087e6e92ce3a99f46cf32373f3dee2dbf Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Wed, 26 Feb 2025 10:00:30 +0000 Subject: [PATCH 1/2] Unmapped windows with size constraints need to adjust them for SSDs --- src/server/shell/abstract_shell.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/server/shell/abstract_shell.cpp b/src/server/shell/abstract_shell.cpp index c4be09d5ec..c8c29afc17 100644 --- a/src/server/shell/abstract_shell.cpp +++ b/src/server/shell/abstract_shell.cpp @@ -229,13 +229,16 @@ auto msh::AbstractShell::create_surface( auto wm_visible_spec{spec}; // When adding decorations we need to resize the window for WM - if (wm_visible_spec.server_side_decorated.value_or(false) && wm_visible_spec.width.is_set() && wm_visible_spec.height.is_set()) + if (wm_visible_spec.server_side_decorated.value_or(false)) { - geom::Size const content_size{wm_visible_spec.width.value(), wm_visible_spec.height.value()}; + // If there's no size we fake and only use it to adjust constraints + geom::Size const content_size{ + wm_visible_spec.width.value_or(geom::Width{640}), + wm_visible_spec.height.value_or(geom::Height{480})}; auto const size = decoration_manager->compute_size_with_decorations( content_size, wm_visible_spec.type.value(), - wm_visible_spec.state.value()); + wm_visible_spec.state.value_or(mir_window_state_restored)); adjust_size_constraints_for_ssd(wm_visible_spec, size, content_size); } From bcf38d13ca3bf1d0888064c0eb3fbf148b3a622a Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Wed, 26 Feb 2025 13:59:00 +0000 Subject: [PATCH 2/2] Don't assume the window type is set - there are tests that don't set it --- src/server/shell/abstract_shell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/shell/abstract_shell.cpp b/src/server/shell/abstract_shell.cpp index c8c29afc17..c8ad146676 100644 --- a/src/server/shell/abstract_shell.cpp +++ b/src/server/shell/abstract_shell.cpp @@ -237,7 +237,7 @@ auto msh::AbstractShell::create_surface( wm_visible_spec.height.value_or(geom::Height{480})}; auto const size = decoration_manager->compute_size_with_decorations( content_size, - wm_visible_spec.type.value(), + wm_visible_spec.type.value_or(mir_window_type_normal), wm_visible_spec.state.value_or(mir_window_state_restored)); adjust_size_constraints_for_ssd(wm_visible_spec, size, content_size);