clutter/actor: Remove absolute_origin_changed flag again

We introduced the absolute_origin_changed flag when preparing for the
removal of ClutterAllocationFlags in commit dc8e5c7f8b. Turns out in the
mean-time commit df4eeff6f2 happened, which renders the whole
absolute_origin_changed flag moot.

That's because we now notify the whole subtree about the absolute origin
change by calling transform_changed() when the allocation of an actor
changes. transform_changed() traverses the subtree and calls
absolute_geometry_changed() on every actor immediately, which renders
the whole propagation of the absolute_origin_changed flag obsolete.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1498
This commit is contained in:
Jonas Dreßler 2020-07-03 14:38:14 +02:00
parent 29caa5bea5
commit 76578e5aa0

View File

@ -858,7 +858,6 @@ struct _ClutterActorPrivate
guint needs_y_expand : 1; guint needs_y_expand : 1;
guint needs_paint_volume_update : 1; guint needs_paint_volume_update : 1;
guint had_effects_on_last_paint_volume_update : 1; guint had_effects_on_last_paint_volume_update : 1;
guint absolute_origin_changed : 1;
guint needs_update_stage_views : 1; guint needs_update_stage_views : 1;
guint has_inverse_transform : 1; guint has_inverse_transform : 1;
}; };
@ -2608,11 +2607,6 @@ clutter_actor_set_allocation_internal (ClutterActor *self,
priv->needs_height_request = FALSE; priv->needs_height_request = FALSE;
priv->needs_allocation = FALSE; priv->needs_allocation = FALSE;
priv->absolute_origin_changed |= x1_changed || y1_changed;
if (priv->absolute_origin_changed || x2_changed || y2_changed)
absolute_geometry_changed (self);
if (x1_changed || if (x1_changed ||
y1_changed || y1_changed ||
x2_changed || x2_changed ||
@ -2621,6 +2615,7 @@ clutter_actor_set_allocation_internal (ClutterActor *self,
CLUTTER_NOTE (LAYOUT, "Allocation for '%s' changed", CLUTTER_NOTE (LAYOUT, "Allocation for '%s' changed",
_clutter_actor_get_debug_name (self)); _clutter_actor_get_debug_name (self));
/* This will also call absolute_geometry_changed() on the subtree */
transform_changed (self); transform_changed (self);
g_object_notify_by_pspec (obj, obj_props[PROP_ALLOCATION]); g_object_notify_by_pspec (obj, obj_props[PROP_ALLOCATION]);
@ -9554,25 +9549,10 @@ clutter_actor_allocate (ClutterActor *self,
priv = self->priv; priv = self->priv;
priv->absolute_origin_changed = priv->parent
? priv->parent->priv->absolute_origin_changed
: FALSE;
if (!CLUTTER_ACTOR_IS_TOPLEVEL (self) && if (!CLUTTER_ACTOR_IS_TOPLEVEL (self) &&
!CLUTTER_ACTOR_IS_MAPPED (self) && !CLUTTER_ACTOR_IS_MAPPED (self) &&
!clutter_actor_has_mapped_clones (self)) !clutter_actor_has_mapped_clones (self))
{ return;
if (priv->absolute_origin_changed)
{
_clutter_actor_traverse (self,
CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST,
absolute_geometry_changed_cb,
NULL,
NULL);
}
goto out;
}
old_allocation = priv->allocation; old_allocation = priv->allocation;
real_allocation = *box; real_allocation = *box;
@ -9615,22 +9595,12 @@ clutter_actor_allocate (ClutterActor *self,
* queue_relayout() and needs a new allocation. * queue_relayout() and needs a new allocation.
* *
* In case needs_allocation isn't set and we didn't move nor resize, we * In case needs_allocation isn't set and we didn't move nor resize, we
* can safely stop allocating, but we need to notify the sub-tree in case * can safely stop allocating.
* our absolute origin changed.
*/ */
if (!priv->needs_allocation && !origin_changed && !size_changed) if (!priv->needs_allocation && !origin_changed && !size_changed)
{ {
if (priv->absolute_origin_changed)
{
_clutter_actor_traverse (self,
CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST,
absolute_geometry_changed_cb,
NULL,
NULL);
}
CLUTTER_NOTE (LAYOUT, "No allocation needed"); CLUTTER_NOTE (LAYOUT, "No allocation needed");
goto out; return;
} }
if (CLUTTER_ACTOR_IS_MAPPED (self)) if (CLUTTER_ACTOR_IS_MAPPED (self))
@ -9641,16 +9611,13 @@ clutter_actor_allocate (ClutterActor *self,
/* If the actor didn't move but needs_allocation is set, we just /* If the actor didn't move but needs_allocation is set, we just
* need to allocate the children (see comment above) */ * need to allocate the children (see comment above) */
clutter_actor_allocate_internal (self, &real_allocation); clutter_actor_allocate_internal (self, &real_allocation);
goto out; return;
} }
if (_clutter_actor_create_transition (self, obj_props[PROP_ALLOCATION], if (_clutter_actor_create_transition (self, obj_props[PROP_ALLOCATION],
&priv->allocation, &priv->allocation,
&real_allocation)) &real_allocation))
clutter_actor_allocate_internal (self, &priv->allocation); clutter_actor_allocate_internal (self, &priv->allocation);
out:
priv->absolute_origin_changed = FALSE;
} }
/** /**