From d66e3e2d8a0ae5e1fb4a145c7d05148325b6165e Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Mon, 22 Nov 2021 07:42:08 +0100 Subject: [PATCH] window/wayland: Detect client resizes with pending non-resizes The previous code was trying to detect client resizes by only considering resizes without any pending configurations as client resizes. There can however be pending configurations that do not involve resizing, such as ones triggered by state changes. These may also stay unacknowledged by the client until the next size change. This was causing client resizes after showing the window (and therefore changing its status to focused) to not be detected as client resize. Fix this by checking whether the queue has any configuration with size changes rather than just whether it is empty. Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2023 Part-of: --- src/wayland/meta-window-wayland.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c index 0927fabdd..fb7198e8b 100644 --- a/src/wayland/meta-window-wayland.c +++ b/src/wayland/meta-window-wayland.c @@ -861,6 +861,22 @@ acquire_acked_configuration (MetaWindowWayland *wl_window, return NULL; } +static gboolean +has_pending_resize (MetaWindowWayland *wl_window) +{ + GList *l; + + for (l = wl_window->pending_configurations; l; l = l->next) + { + MetaWaylandWindowConfiguration *configuration = l->data; + + if (configuration->has_size) + return TRUE; + } + + return FALSE; +} + int meta_window_wayland_get_geometry_scale (MetaWindow *window) { @@ -944,7 +960,7 @@ meta_window_wayland_finish_move_resize (MetaWindow *window, flags = META_MOVE_RESIZE_WAYLAND_FINISH_MOVE_RESIZE; - if (!wl_window->pending_configurations) + if (!has_pending_resize (wl_window)) flags |= META_MOVE_RESIZE_WAYLAND_CLIENT_RESIZE; acked_configuration = acquire_acked_configuration (wl_window, pending);