[mutter] clutter/actor: Remove clutter_actor_maybe_layout_children()



commit 7ae6e0101c451373d680ef8361ac68a07dc69af2
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Sat May 9 20:22:51 2020 +0200

    clutter/actor: Remove clutter_actor_maybe_layout_children()
    
    Since we now only layout the children ourselves in case the actor
    implementation doesn't override the allocate vfunc, we can remove
    clutter_actor_maybe_layout_children() and move the functionality inside
    clutter_actor_real_allocate().
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1245

 clutter/clutter/clutter-actor.c | 59 +++++++++++++----------------------------
 1 file changed, 19 insertions(+), 40 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index c134edffd..e04896cfd 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -2638,33 +2638,32 @@ clutter_actor_set_allocation_internal (ClutterActor           *self,
   return retval;
 }
 
-static void clutter_actor_real_allocate (ClutterActor           *self,
-                                         const ClutterActorBox  *box,
-                                         ClutterAllocationFlags  flags);
-
-static inline void
-clutter_actor_maybe_layout_children (ClutterActor           *self,
-                                     const ClutterActorBox  *allocation,
-                                     ClutterAllocationFlags  flags)
+static void
+clutter_actor_real_allocate (ClutterActor           *self,
+                             const ClutterActorBox  *box,
+                             ClutterAllocationFlags  flags)
 {
   ClutterActorPrivate *priv = self->priv;
+  gboolean changed;
 
-  if (CLUTTER_ACTOR_GET_CLASS (self)->allocate == clutter_actor_real_allocate)
-    goto check_layout;
+  g_object_freeze_notify (G_OBJECT (self));
 
-  return;
+  changed = clutter_actor_set_allocation_internal (self, box, flags);
 
-check_layout:
+  /* we allocate our children before we notify changes in our geometry,
+   * so that people connecting to properties will be able to get valid
+   * data out of the sub-tree of the scene graph that has this actor at
+   * the root.
+   */
   if (priv->n_children != 0 &&
       priv->layout_manager != NULL)
     {
-      ClutterContainer *container = CLUTTER_CONTAINER (self);
       ClutterActorBox children_box;
 
       /* normalize the box passed to the layout manager */
       children_box.x1 = children_box.y1 = 0.f;
-      children_box.x2 = (allocation->x2 - allocation->x1);
-      children_box.y2 = (allocation->y2 - allocation->y1);
+      children_box.x2 = box->x2 - box->x1;
+      children_box.y2 = box->y2 - box->y1;
 
       CLUTTER_NOTE (LAYOUT,
                     "Allocating %d children of %s "
@@ -2672,37 +2671,17 @@ check_layout:
                     "using %s",
                     priv->n_children,
                     _clutter_actor_get_debug_name (self),
-                    allocation->x1,
-                    allocation->y1,
-                    (allocation->x2 - allocation->x1),
-                    (allocation->y2 - allocation->y1),
+                    box->x1,
+                    box->y1,
+                    (box->x2 - box->x1),
+                    (box->y2 - box->y1),
                     G_OBJECT_TYPE_NAME (priv->layout_manager));
 
       clutter_layout_manager_allocate (priv->layout_manager,
-                                       container,
+                                       CLUTTER_CONTAINER (self),
                                        &children_box,
                                        flags);
     }
-}
-
-static void
-clutter_actor_real_allocate (ClutterActor           *self,
-                             const ClutterActorBox  *box,
-                             ClutterAllocationFlags  flags)
-{
-  ClutterActorPrivate *priv = self->priv;
-  gboolean changed;
-
-  g_object_freeze_notify (G_OBJECT (self));
-
-  changed = clutter_actor_set_allocation_internal (self, box, flags);
-
-  /* we allocate our children before we notify changes in our geometry,
-   * so that people connecting to properties will be able to get valid
-   * data out of the sub-tree of the scene graph that has this actor at
-   * the root.
-   */
-  clutter_actor_maybe_layout_children (self, box, flags);
 
   if (changed)
     {


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