window: Let implementations finish state changes

In the old, synchronous X.org world, we could assume that
a state change always meant a synchronizing the window
geometry right after. After firing an operation that
would change the window state, such as maximizing or
tiling the window,

With Wayland, however, this is not valid anymore, since
Wayland is asynchronous. In this scenario, we call
meta_window_move_resize_internal() twice: when the user
executes an state-changing operation, and when the server
ACKs this operation. This breaks the previous assumptions,
and as a consequence, it breaks the GNOME Shell animations
in Wayland.

The solution is giving the MetaWindow control over the time
when the window geometry is synchronized with the compositor.
That is done by introducing a new result flag. Wayland asks
for a compositor sync after receiving an ACK from the server,
while X11 asks for it right away.

Fixes #78
This commit is contained in:
Georges Basile Stavracas Neto
2018-04-17 23:42:33 -03:00
parent b412e6c493
commit 822c2666f5
4 changed files with 23 additions and 7 deletions

View File

@ -81,6 +81,7 @@ typedef enum
META_MOVE_RESIZE_STATE_CHANGED = 1 << 5,
META_MOVE_RESIZE_UNMAXIMIZE = 1 << 6,
META_MOVE_RESIZE_FORCE_MOVE = 1 << 7,
META_MOVE_RESIZE_WAYLAND_STATE_CHANGED = 1 << 8,
} MetaMoveResizeFlags;
typedef enum
@ -88,6 +89,7 @@ typedef enum
META_MOVE_RESIZE_RESULT_MOVED = 1 << 0,
META_MOVE_RESIZE_RESULT_RESIZED = 1 << 1,
META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED = 1 << 2,
META_MOVE_RESIZE_RESULT_STATE_CHANGED = 1 << 3,
} MetaMoveResizeResultFlags;
typedef enum

View File

@ -3997,7 +3997,7 @@ meta_window_move_resize_internal (MetaWindow *window,
if ((moved_or_resized ||
did_placement ||
(flags & META_MOVE_RESIZE_STATE_CHANGED) != 0) &&
(result & META_MOVE_RESIZE_RESULT_STATE_CHANGED) != 0) &&
window->known_to_compositor)
{
meta_compositor_sync_window_geometry (window->display->compositor,