From 89807a66c71dda23f2a5c92b20294be5998dcb71 Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Mon, 23 Sep 2024 16:44:06 +0000 Subject: [PATCH] Revert "Fix toplevel window resize pingpong (#3575)" and fix better (#3599) Fixes: #3600 Fixes: #3592 Fixes: #3573 --- .../wayland_surface_observer.cpp | 16 +++++++++++++--- .../frontend_wayland/wayland_surface_observer.h | 1 - 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/server/frontend_wayland/wayland_surface_observer.cpp b/src/server/frontend_wayland/wayland_surface_observer.cpp index 22b4838299..1b4ce6c4db 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 05ecd80ec6..46134a829f 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