[mutter] clutter/actor: Queue relayouts in more clone cases



commit 8d04b9067d75dea5973adc94b6f4c049657d5dfd
Author: Robert Mader <robert mader posteo de>
Date:   Mon Jul 25 21:45:07 2022 +0200

    clutter/actor: Queue relayouts in more clone cases
    
    In certain edge cases it's currently possible that an actor never
    gets a valid allocation and paint volume.
    
    One such case is adding an unmapped, hidden child to an unmapped
    cloned parent and then showing the child. This happens currently
     e.g. if a Wayland subsurface is added to a already mapped window
    while the user is in the overview.
    
    Ensure relayouts in two more such cases.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2530>

 clutter/clutter/clutter-actor.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 1a04a4f9f0..e07af3d164 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -1777,6 +1777,18 @@ clutter_actor_real_show (ClutterActor *self)
    * and the branch of the scene graph is in a stable state
    */
   clutter_actor_update_map_state (self, MAP_STATE_CHECK);
+
+  if (clutter_actor_has_mapped_clones (self))
+    {
+      ClutterActorPrivate *priv = self->priv;
+
+      /* Avoid the early return in clutter_actor_queue_relayout() */
+      priv->needs_width_request = FALSE;
+      priv->needs_height_request = FALSE;
+      priv->needs_allocation = FALSE;
+
+      clutter_actor_queue_relayout (self);
+    }
 }
 
 static inline void
@@ -11699,6 +11711,18 @@ clutter_actor_add_child_internal (ClutterActor              *self,
   if (CLUTTER_ACTOR_IS_MAPPED (child))
     clutter_actor_queue_redraw (child);
 
+  if (clutter_actor_has_mapped_clones (self))
+    {
+      ClutterActorPrivate *priv = self->priv;
+
+      /* Avoid the early return in clutter_actor_queue_relayout() */
+      priv->needs_width_request = FALSE;
+      priv->needs_height_request = FALSE;
+      priv->needs_allocation = FALSE;
+
+      clutter_actor_queue_relayout (self);
+    }
+
   if (emit_actor_added)
     _clutter_container_emit_actor_added (CLUTTER_CONTAINER (self), child);
 


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