From 8d04b9067d75dea5973adc94b6f4c049657d5dfd Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Mon, 25 Jul 2022 21:45:07 +0200 Subject: [PATCH] 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: --- 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 1a04a4f9f..e07af3d16 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);