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
This commit is contained in:
Georges Basile Stavracas Neto 2018-03-17 04:52:44 -03:00
parent 822c2666f5
commit 762a3f89a9
2 changed files with 8 additions and 0 deletions

View File

@ -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;
}

View File

@ -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