clutter/align-constraint: Listen to queue-relayout signal of source

Just like the ClutterBindConstraint, the ClutterAlignConstraint should
listen to "queue-relayout" of its source actor, not
"notify::allocation". That's because the latter will queue a relayout
during an allocation cycle and might cause relayout loops.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1296
This commit is contained in:
Jonas Dreßler 2020-06-08 15:11:42 +02:00 committed by Georges Basile Stavracas Neto
parent 99c9f4c1fa
commit 455de5d6d3

View File

@ -84,12 +84,11 @@ G_DEFINE_TYPE (ClutterAlignConstraint,
CLUTTER_TYPE_CONSTRAINT);
static void
source_position_changed (ClutterActor *actor,
GParamSpec *pspec,
ClutterAlignConstraint *align)
source_queue_relayout (ClutterActor *actor,
ClutterAlignConstraint *align)
{
if (align->actor != NULL)
clutter_actor_queue_relayout (align->actor);
_clutter_actor_queue_only_relayout (align->actor);
}
static void
@ -186,7 +185,7 @@ clutter_align_constraint_dispose (GObject *gobject)
G_CALLBACK (source_destroyed),
align);
g_signal_handlers_disconnect_by_func (align->source,
G_CALLBACK (source_position_changed),
G_CALLBACK (source_queue_relayout),
align);
align->source = NULL;
}
@ -402,15 +401,15 @@ clutter_align_constraint_set_source (ClutterAlignConstraint *align,
G_CALLBACK (source_destroyed),
align);
g_signal_handlers_disconnect_by_func (old_source,
G_CALLBACK (source_position_changed),
G_CALLBACK (source_queue_relayout),
align);
}
align->source = source;
if (align->source != NULL)
{
g_signal_connect (align->source, "notify::allocation",
G_CALLBACK (source_position_changed),
g_signal_connect (align->source, "queue-relayout",
G_CALLBACK (source_queue_relayout),
align);
g_signal_connect (align->source, "destroy",
G_CALLBACK (source_destroyed),