MetaWindowActor: Add a 'position-changed' signal

Similar to the recently added 'size-changed' signal, we may want to do
something in response to a window being repositioned without waiting for
notify::allocation. (Especially since what we can do in notify::allocation
is severely limited by Clutter forbidding queueing an allocation at that
point.)

https://bugzilla.gnome.org/show_bug.cgi?id=641310
This commit is contained in:
Owen W. Taylor 2011-02-01 11:24:39 -05:00
parent 3716c30264
commit a9504f1495

View File

@ -25,6 +25,7 @@
#include "meta-window-actor-private.h" #include "meta-window-actor-private.h"
enum { enum {
POSITION_CHANGED,
SIZE_CHANGED, SIZE_CHANGED,
LAST_SIGNAL LAST_SIGNAL
}; };
@ -284,6 +285,13 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
PROP_SHADOW_CLASS, PROP_SHADOW_CLASS,
pspec); pspec);
signals[POSITION_CHANGED] =
g_signal_new ("position-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[SIZE_CHANGED] = signals[SIZE_CHANGED] =
g_signal_new ("size-changed", g_signal_new ("size-changed",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
@ -1332,6 +1340,8 @@ meta_window_actor_sync_actor_position (MetaWindowActor *self)
window_rect.x, window_rect.y); window_rect.x, window_rect.y);
clutter_actor_set_size (CLUTTER_ACTOR (self), clutter_actor_set_size (CLUTTER_ACTOR (self),
window_rect.width, window_rect.height); window_rect.width, window_rect.height);
g_signal_emit (self, signals[POSITION_CHANGED], 0);
} }
void void