compositor: get rid of initial black rectangle on xwayland clients

At the moment when a legacy X11 application client is first mapped it
gets briefly shown as a black rectangle before redrawing.

That behavior is because the initial Configure operation on the window
leads to the surface immediately getting full window damage posted by
Xwayland before the client has a chance to draw.

This commit changes mutter to send a sync request right away, when a
window first shows up, then waits until the reply from the application
before showing the window.

It leverages the same code paths already used to prevent flicker from
subsequent (non-initial) resizes on the window.
This commit is contained in:
Ray Strode 2018-03-16 17:04:09 -04:00
parent 7f4f5f5c4c
commit 8904c55a86
2 changed files with 19 additions and 2 deletions

View File

@ -53,6 +53,8 @@ struct _MetaWindowActorPrivate
MetaWindow *window;
MetaCompositor *compositor;
MetaCompEffect pending_effect;
MetaSurfaceActor *surface;
/* MetaShadowFactory only caches shadows that are actually in use;
@ -117,6 +119,7 @@ struct _MetaWindowActorPrivate
guint updates_frozen : 1;
guint first_frame_state : 2; /* FirstFrameState */
guint has_pending_effect : 1;
};
typedef struct _FrameData FrameData;
@ -363,6 +366,12 @@ meta_window_actor_sync_thawed_state (MetaWindowActor *self)
if (priv->first_frame_state == INITIALLY_FROZEN)
priv->first_frame_state = DRAWING_FIRST_FRAME;
if (priv->has_pending_effect)
{
meta_window_actor_show (self, priv->pending_effect);
priv->has_pending_effect = FALSE;
}
if (priv->surface)
meta_surface_actor_set_frozen (priv->surface, FALSE);
@ -1321,6 +1330,13 @@ meta_window_actor_show (MetaWindowActor *self,
g_return_if_fail (!priv->visible);
if (is_frozen (self))
{
priv->pending_effect = effect;
priv->has_pending_effect = TRUE;
return;
}
self->priv->visible = TRUE;
switch (effect)

View File

@ -1244,8 +1244,9 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
{
meta_error_trap_push (window->display);
if (window == window->display->grab_window &&
meta_grab_op_is_resizing (window->display->grab_op) &&
if ((window->constructing ||
(window == window->display->grab_window &&
meta_grab_op_is_resizing (window->display->grab_op))) &&
!window->disable_sync &&
window->sync_request_counter != None &&
window->sync_request_alarm != None &&