From fb474fb612134eb611afe151620bc798434ef1b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Tue, 12 May 2020 12:04:28 +0200 Subject: [PATCH] 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 --- src/compositor/meta-window-actor.c | 34 ++++++++++++++++++++++++------ src/meta/meta-window-actor.h | 6 ++++++ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index 1207f1fb7..fc8ac2c2e 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -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"); diff --git a/src/meta/meta-window-actor.h b/src/meta/meta-window-actor.h index 7d3b96e59..6e18683a2 100644 --- a/src/meta/meta-window-actor.h +++ b/src/meta/meta-window-actor.h @@ -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,