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.
This commit is contained in:
Florian Müllner 2011-01-25 21:08:43 +01:00
parent 19d1f97600
commit ad707be01e

View File

@ -24,6 +24,14 @@
#include "meta-shaped-texture.h" #include "meta-shaped-texture.h"
#include "meta-window-actor-private.h" #include "meta-window-actor-private.h"
enum {
SIZE_CHANGED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = {0};
struct _MetaWindowActorPrivate struct _MetaWindowActorPrivate
{ {
XWindowAttributes attrs; XWindowAttributes attrs;
@ -275,6 +283,14 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_SHADOW_CLASS, PROP_SHADOW_CLASS,
pspec); 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 static void
@ -1607,6 +1623,8 @@ meta_window_actor_update_bounding_region (MetaWindowActor *self,
*/ */
if (!priv->shaped) if (!priv->shaped)
meta_window_actor_invalidate_shadow (self); meta_window_actor_invalidate_shadow (self);
g_signal_emit (self, signals[SIZE_CHANGED], 0);
} }
static void static void