From 85bbd82ae847eed0bba943c119a356d9493f7da2 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Wed, 4 Apr 2018 10:10:32 +0200 Subject: [PATCH] window-actor: add new signal "effects-completed" When using plugins, the effects will affect the MetaWindowActor size and position. Add a new signal "effects-completed" wired to the corresponding MetaWindowActor which is emitted when all effects are completed so that derived objects can be notified when all effects are completed and use the actual size and position. Closes: https://gitlab.gnome.org/GNOME/mutter/issues/104 --- src/compositor/meta-window-actor-private.h | 1 + src/compositor/meta-window-actor.c | 24 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h index 6b52ef5b5..ce5e7eadc 100644 --- a/src/compositor/meta-window-actor-private.h +++ b/src/compositor/meta-window-actor-private.h @@ -58,5 +58,6 @@ void meta_window_actor_effect_completed (MetaWindowActor *actor, MetaSurfaceActor *meta_window_actor_get_surface (MetaWindowActor *self); void meta_window_actor_update_surface (MetaWindowActor *self); +MetaWindowActor *meta_window_actor_from_window (MetaWindow *window); #endif /* META_WINDOW_ACTOR_PRIVATE_H */ diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index c67b2b7b0..5078624cc 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -142,6 +142,8 @@ struct _FrameData enum { FIRST_FRAME, + EFFECTS_COMPLETED, + LAST_SIGNAL }; @@ -238,6 +240,21 @@ meta_window_actor_class_init (MetaWindowActorClass *klass) NULL, NULL, NULL, G_TYPE_NONE, 0); + /** + * MetaWindowActor::effects-completed: + * @actor: the #MetaWindowActor instance + * + * The ::effects-completed signal will be emitted once all pending compositor + * effects are completed. + */ + signals[EFFECTS_COMPLETED] = + g_signal_new ("effects-completed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, NULL, + G_TYPE_NONE, 0); + pspec = g_param_spec_object ("meta-window", "MetaWindow", "The displayed MetaWindow", @@ -1131,6 +1148,7 @@ meta_window_actor_after_effects (MetaWindowActor *self) return; } + g_signal_emit (self, signals[EFFECTS_COMPLETED], 0); meta_window_actor_sync_visibility (self); meta_window_actor_sync_actor_geometry (self, FALSE); } @@ -2157,3 +2175,9 @@ meta_window_actor_sync_updates_frozen (MetaWindowActor *self) meta_window_actor_set_updates_frozen (self, meta_window_updates_are_frozen (window)); } + +MetaWindowActor * +meta_window_actor_from_window (MetaWindow *window) +{ + return META_WINDOW_ACTOR (meta_window_get_compositor_private (window)); +}