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); }); } diff --git a/src/server/frontend_wayland/wayland_surface_observer.h b/src/server/frontend_wayland/wayland_surface_observer.h index 05ecd80ec6f..46134a829f2 100644 --- a/src/server/frontend_wayland/wayland_surface_observer.h +++ b/src/server/frontend_wayland/wayland_surface_observer.h @@ -64,7 +64,6 @@ class WaylandSurfaceObserver : public scene::NullSurfaceObserver void latest_client_size(geometry::Size window_size) { impl->window_size = window_size; - impl->requested_size = {}; } /// Should only be called from the Wayland thread