clutter/actor: Update absolute_origin_changed inside set_allocation()

When manipulating the allocation of a ClutterActor from an allocate()
vfunc override, clutter_actor_set_allocation() is used to let Clutter
know about the changes.

If the actors allocation or its absolute origin did not change before
that, this can also affect the actors absolute_origin_changed property
used by the children to detect changes to their absolute position.

So fix this bug (which luckily didn't seem to affect us so far) and set
priv->absolute_origin_changed to TRUE in case the origin changes inside
clutter_actor_set_allocation_internal(). Since this function is always
called when our allocation changes, we no longer need to update
absolute_origin_changed in clutter_actor_allocate() now.

Since a change to the absolute origin always affects the resource scale,
too, we also need to move that check from clutter_actor_allocate() here
to make sure we update the resource scale.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1247
This commit is contained in:
Jonas Dreßler 2020-05-09 23:39:26 +02:00 committed by Jonas Ådahl
parent 9f121a211d
commit 0a37c32a72

View File

@ -2603,6 +2603,11 @@ clutter_actor_set_allocation_internal (ClutterActor *self,
priv->needs_height_request = FALSE;
priv->needs_allocation = FALSE;
priv->absolute_origin_changed |= x1_changed || y1_changed;
if (priv->absolute_origin_changed || x2_changed || y2_changed)
priv->needs_compute_resource_scale = TRUE;
if (x1_changed ||
y1_changed ||
x2_changed ||
@ -10146,9 +10151,8 @@ clutter_actor_allocate (ClutterActor *self,
? priv->parent->priv->absolute_origin_changed
: FALSE;
priv->absolute_origin_changed |= origin_changed;
stage_allocation_changed = priv->absolute_origin_changed || size_changed;
stage_allocation_changed =
priv->absolute_origin_changed || origin_changed || size_changed;
/* If we get an allocation "out of the blue"
* (we did not queue relayout), then we want to
@ -10171,9 +10175,6 @@ clutter_actor_allocate (ClutterActor *self,
if (CLUTTER_ACTOR_IS_MAPPED (self))
self->priv->needs_paint_volume_update = TRUE;
if (stage_allocation_changed)
priv->needs_compute_resource_scale = TRUE;
if (!stage_allocation_changed)
{
/* If the actor didn't move but needs_allocation is set, we just