[mutter/wip/ssd-black-borders-fix: 22/22] compositor: get rid of initial black rectangle on xwayland clients



commit d8b2e46f0976bae623adc413583d7ae004dbd1cf
Author: Ray Strode <rstrode redhat com>
Date:   Fri Mar 16 17:04:09 2018 -0400

    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.

 src/compositor/meta-window-actor.c | 14 ++++++++++++++
 src/x11/window-x11.c               |  5 +++--
 2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index efb939a20..71f8e9a84 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -53,6 +53,8 @@ struct _MetaWindowActorPrivate
   MetaWindow *window;
   MetaCompositor *compositor;
 
+  MetaCompEffect  pending_effect;
+
   MetaSurfaceActor *surface;
 
   /* MetaShadowFactory only caches shadows that are actually in use;
@@ -363,6 +365,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->pending_effect != META_COMP_EFFECT_NONE)
+    {
+      meta_window_actor_show (self, priv->pending_effect);
+      priv->pending_effect = META_COMP_EFFECT_NONE;
+    }
+
   if (priv->surface)
     meta_surface_actor_set_frozen (priv->surface, FALSE);
 
@@ -1321,6 +1329,12 @@ meta_window_actor_show (MetaWindowActor   *self,
 
   g_return_if_fail (!priv->visible);
 
+  if (is_frozen (self))
+    {
+      priv->pending_effect = effect;
+      return;
+    }
+
   self->priv->visible = TRUE;
 
   switch (effect)
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index 94f62718b..c14f90070 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -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 &&


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]