From ad707be01ea9c3a7186a12ed8077d95d468ceee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 25 Jan 2011 21:08:43 +0100 Subject: [PATCH] window-actor: Add "size-changed" signal Emit a signal when the window size changes. While it is already possible to connect to notify::allocation (or width/height), the new signal is emitted outside a clutter allocation cycle, which makes it more convenient when adjusting an actor's size/position in response. --- src/compositor/meta-window-actor.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index e3c0cd907..b387e03d7 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -24,6 +24,14 @@ #include "meta-shaped-texture.h" #include "meta-window-actor-private.h" +enum { + SIZE_CHANGED, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = {0}; + + struct _MetaWindowActorPrivate { XWindowAttributes attrs; @@ -275,6 +283,14 @@ meta_window_actor_class_init (MetaWindowActorClass *klass) g_object_class_install_property (object_class, PROP_SHADOW_CLASS, pspec); + + signals[SIZE_CHANGED] = + g_signal_new ("size-changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void @@ -1607,6 +1623,8 @@ meta_window_actor_update_bounding_region (MetaWindowActor *self, */ if (!priv->shaped) meta_window_actor_invalidate_shadow (self); + + g_signal_emit (self, signals[SIZE_CHANGED], 0); } static void