[mutter] MetaWindowActor: Sync thawed state when surface actor is set



commit 2e7f11305c00a37d71212e285ea53c10249a9d63
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Sep 7 16:20:15 2016 +0800

    MetaWindowActor: Sync thawed state when surface actor is set
    
    Not having a surface actor would cause the window actor state to be
    considered frozen, thus causing various state (such as geometry, shape
    etc) synchronization to be delayed until thawed. If the window actor
    was "thawed" due to having a surface set, not all state would be
    properly synchronized, causing the thawed window actor to be displayed
    incorrectly.
    
    This patch fixes this by putting state synchronization after thawing in
    a common function, calling it both from frozen count decreasing and
    surface setting.
    
    This fixes for example misplaced menus in Steam.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770991

 src/compositor/meta-window-actor.c |   38 ++++++++++++++++++++++-------------
 1 files changed, 24 insertions(+), 14 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 25a8f11..658a177 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -350,6 +350,21 @@ meta_window_actor_freeze (MetaWindowActor *self)
 }
 
 static void
+meta_window_actor_sync_thawed_state (MetaWindowActor *self)
+{
+  MetaWindowActorPrivate *priv = self->priv;
+
+  if (priv->first_frame_state == INITIALLY_FROZEN)
+    priv->first_frame_state = DRAWING_FIRST_FRAME;
+
+  if (priv->surface)
+    meta_surface_actor_set_frozen (priv->surface, FALSE);
+
+  /* We sometimes ignore moves and resizes on frozen windows */
+  meta_window_actor_sync_actor_geometry (self, FALSE);
+}
+
+static void
 meta_window_actor_thaw (MetaWindowActor *self)
 {
   MetaWindowActorPrivate *priv = self->priv;
@@ -361,14 +376,11 @@ meta_window_actor_thaw (MetaWindowActor *self)
   if (priv->freeze_count > 0)
     return;
 
-  if (priv->first_frame_state == INITIALLY_FROZEN)
-    priv->first_frame_state = DRAWING_FIRST_FRAME;
+  /* We still might be frozen due to lack of a MetaSurfaceActor */
+  if (is_frozen (self))
+    return;
 
-  if (priv->surface)
-    meta_surface_actor_set_frozen (priv->surface, FALSE);
-
-  /* We sometimes ignore moves and resizes on frozen windows */
-  meta_window_actor_sync_actor_geometry (self, FALSE);
+  meta_window_actor_sync_thawed_state (self);
 
   /* We do this now since we might be going right back into the
    * frozen state */
@@ -401,14 +413,12 @@ set_surface (MetaWindowActor  *self,
                                                 G_CALLBACK (surface_size_changed), self);
       clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
 
-      /* If the previous surface actor was frozen, start out
-       * frozen as well... */
-      meta_surface_actor_set_frozen (priv->surface, priv->freeze_count > 0);
-
-      if (!is_frozen (self) && priv->first_frame_state == INITIALLY_FROZEN)
-        priv->first_frame_state = DRAWING_FIRST_FRAME;
-
       meta_window_actor_update_shape (self);
+
+      if (is_frozen (self))
+        meta_surface_actor_set_frozen (priv->surface, TRUE);
+      else
+        meta_window_actor_sync_thawed_state (self);
     }
 }
 


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