bind-constraint: Use ::queue-relayout

Instead of using the allocation-changed signal, use the queue-relayout
signal on the source to queue a relayout on the actor to which the
BindConstraint has been attached to.

The ::allocation-changed signal is not always enough, given that a
BindConstraint can use the position as well as the size of an actor to
drive the allocation of another; in this regard, it's much similar
to a ClutterClone, which requires a notification on every change, even
potential, and not just real ones, given the short-circuiting done
inside ClutterActor.
This commit is contained in:
Emmanuele Bassi 2010-10-12 14:09:47 +01:00
parent 5c82b2551c
commit 4e724aed46

View File

@ -130,10 +130,8 @@ G_DEFINE_TYPE (ClutterBindConstraint,
CLUTTER_TYPE_CONSTRAINT); CLUTTER_TYPE_CONSTRAINT);
static void static void
source_allocation_changed (ClutterActor *source, source_queue_relayout (ClutterActor *source,
const ClutterActorBox *allocation, ClutterBindConstraint *bind)
ClutterAllocationFlags flags,
ClutterBindConstraint *bind)
{ {
if (bind->actor != NULL) if (bind->actor != NULL)
clutter_actor_queue_relayout (bind->actor); clutter_actor_queue_relayout (bind->actor);
@ -392,15 +390,15 @@ clutter_bind_constraint_set_source (ClutterBindConstraint *constraint,
G_CALLBACK (source_destroyed), G_CALLBACK (source_destroyed),
constraint); constraint);
g_signal_handlers_disconnect_by_func (old_source, g_signal_handlers_disconnect_by_func (old_source,
G_CALLBACK (source_allocation_changed), G_CALLBACK (source_queue_relayout),
constraint); constraint);
} }
constraint->source = source; constraint->source = source;
if (constraint->source != NULL) if (constraint->source != NULL)
{ {
g_signal_connect (constraint->source, "allocation-changed", g_signal_connect (constraint->source, "queue-relayout",
G_CALLBACK (source_allocation_changed), G_CALLBACK (source_queue_relayout),
constraint); constraint);
g_signal_connect (constraint->source, "destroy", g_signal_connect (constraint->source, "destroy",
G_CALLBACK (source_destroyed), G_CALLBACK (source_destroyed),