From 2e7f11305c00a37d71212e285ea53c10249a9d63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 7 Sep 2016 16:20:15 +0800 Subject: [PATCH] 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 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index 25a8f1176..658a1779d 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -349,6 +349,21 @@ meta_window_actor_freeze (MetaWindowActor *self) priv->freeze_count ++; } +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) { @@ -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); } }