From 762a3f89a99c42fff1022c5cbea9b1a5af42c646 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sat, 17 Mar 2018 04:52:44 -0300 Subject: [PATCH] wayland: Add function to query if window needs move or resize This will be used by the next commit to determine when a window geometry change should be ignored or not. Normally, it would be enough to just check if the position and sizes changed. The position, in this case, is relative to the client buffer, not the global position. But because it is not global, there is one, admitedly unlikely, situation where the window state is updated while the client size and relative positions don't change. One can trigger this by e.g. tiling the window to the half-left of the monitor, then immediately tile it to half-right. In this case, the window didn't change, just it's state, but nonetheless we need to notify the compositor and run the full move/resize routines. When that case happens, though, the MetaWindowWayland is tracking the pending state change or a move. And this is what we need to expose. https://bugzilla.gnome.org/show_bug.cgi?id=780292 Issue: #78 --- src/wayland/meta-window-wayland.c | 7 +++++++ src/wayland/meta-window-wayland.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c index b0a7de14c..705bc4981 100644 --- a/src/wayland/meta-window-wayland.c +++ b/src/wayland/meta-window-wayland.c @@ -915,3 +915,10 @@ meta_window_wayland_get_max_size (MetaWindow *window, scale_size (width, height, scale); } +gboolean +meta_window_wayland_needs_move_resize (MetaWindow *window) +{ + MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window); + + return wl_window->has_pending_state_change || wl_window->has_pending_move; +} diff --git a/src/wayland/meta-window-wayland.h b/src/wayland/meta-window-wayland.h index 408451626..ea5b82cb2 100644 --- a/src/wayland/meta-window-wayland.h +++ b/src/wayland/meta-window-wayland.h @@ -78,5 +78,6 @@ void meta_window_wayland_get_max_size (MetaWindow *window, int *width, int *height); +gboolean meta_window_wayland_needs_move_resize (MetaWindow *window); #endif