window-actor: Make freezing and thawing of actor updates public API

As explained in the last commit, gnome-shell needs to be able to thaw
window actor updates during its size-change effect is active.

So make meta_window_actor_freeze() and meta_window_actor_thaw() public
API, which will allow the shell to freeze and thaw actor updates itself.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1250
This commit is contained in:
Jonas Dreßler 2020-05-12 12:04:28 +02:00 committed by Robert Mader
parent d12dc993d1
commit fb474fb612
2 changed files with 34 additions and 6 deletions

View File

@ -272,11 +272,23 @@ meta_window_actor_set_frozen (MetaWindowActor *self,
META_WINDOW_ACTOR_GET_CLASS (self)->set_frozen (self, frozen);
}
static void
/**
* meta_window_actor_freeze:
* @self: The #MetaWindowActor
*
* Freezes the #MetaWindowActor, which inhibits updates and geometry
* changes of the window. This property is refcounted, so make sure
* to call meta_window_actor_thaw() the exact same amount of times
* as this function to allow updates again.
*/
void
meta_window_actor_freeze (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv =
meta_window_actor_get_instance_private (self);
MetaWindowActorPrivate *priv;
g_return_if_fail (META_IS_WINDOW_ACTOR (self));
priv = meta_window_actor_get_instance_private (self);
if (priv->freeze_count == 0 && priv->surface)
meta_window_actor_set_frozen (self, TRUE);
@ -300,11 +312,21 @@ meta_window_actor_sync_thawed_state (MetaWindowActor *self)
meta_window_actor_sync_actor_geometry (self, FALSE);
}
static void
/**
* meta_window_actor_thaw:
* @self: The #MetaWindowActor
*
* Thaws/unfreezes the #MetaWindowActor to allow updates and geometry
* changes after a window was frozen using meta_window_actor_freeze().
*/
void
meta_window_actor_thaw (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv =
meta_window_actor_get_instance_private (self);
MetaWindowActorPrivate *priv;
g_return_if_fail (META_IS_WINDOW_ACTOR (self));
priv = meta_window_actor_get_instance_private (self);
if (priv->freeze_count <= 0)
g_error ("Error in freeze/thaw accounting");

View File

@ -51,6 +51,12 @@ META_EXPORT
cairo_surface_t * meta_window_actor_get_image (MetaWindowActor *self,
cairo_rectangle_int_t *clip);
META_EXPORT
void meta_window_actor_freeze (MetaWindowActor *self);
META_EXPORT
void meta_window_actor_thaw (MetaWindowActor *self);
typedef enum
{
META_SHADOW_MODE_AUTO,