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
This commit is contained in:
Jonas Ådahl 2016-09-07 16:20:15 +08:00
parent c1b5b76bf4
commit 2e7f11305c

View File

@ -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);
}
}