From 2dd1cb45fdb46305eab070f6a902bf0b997ff6a3 Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Mon, 23 Sep 2024 11:08:44 +0100 Subject: [PATCH] Correct WaylandSurfaceObserver::content_resized_to() logic --- .../wayland_surface_observer.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/server/frontend_wayland/wayland_surface_observer.cpp b/src/server/frontend_wayland/wayland_surface_observer.cpp index 22b4838299b..1b4ce6c4db9 100644 --- a/src/server/frontend_wayland/wayland_surface_observer.cpp +++ b/src/server/frontend_wayland/wayland_surface_observer.cpp @@ -77,11 +77,21 @@ void mf::WaylandSurfaceObserver::content_resized_to(ms::Surface const*, geom::Si run_on_wayland_thread_unless_window_destroyed( [content_size](Impl* impl, WindowWlSurfaceRole* window) { - if (impl->requested_size.value_or(impl->window_size) != content_size) + if (impl->requested_size && impl->requested_size == content_size) { - impl->requested_size = content_size; - window->handle_resize(std::nullopt, content_size); + // We've already requested this size, no action required + return; } + + if (content_size == impl->window_size) + { + // The window manager is accepting the client's window size, no action required + return; + } + + // The window manager is changing the client's window size, tell the client + impl->requested_size = content_size; + window->handle_resize(std::nullopt, content_size); }); }