[mutter] clutter/actor: Update absolute_origin_changed inside set_allocation()



commit 0a37c32a727a8cb4aaa447dfc9574e220baf6bcb
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Sat May 9 23:39:26 2020 +0200

    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

 clutter/clutter/clutter-actor.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 6dbf3668d7..15f7e11e5d 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]