mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
clutter/actor: Don't queue relayouts inside add/remove_child_internal
Since we now moved the queuing of relayouts into the mapping and unmapping functions, we no longer need to do it when adding or removing a child, that's because removing a child always unmaps the child, and adding it to a stage (if it's visible) will map it. So remove those calls to queue_relayout() since they're no longer needed. With the above we no longer queue a relayout in clutter_actor_add_child_internal(), that means there's one place where we need to explicitely queue relayouts now: That's when using the set_child_at_index/above/below() APIs, those are special because they avoid unmapping and mapping of actors and would now no longer get a relayout. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1366
This commit is contained in:
parent
3bca29f303
commit
29caa5bea5
@ -4278,7 +4278,6 @@ clutter_actor_remove_child_internal (ClutterActor *self,
|
|||||||
gboolean destroy_meta, emit_parent_set, emit_actor_removed, check_state;
|
gboolean destroy_meta, emit_parent_set, emit_actor_removed, check_state;
|
||||||
gboolean flush_queue;
|
gboolean flush_queue;
|
||||||
gboolean notify_first_last;
|
gboolean notify_first_last;
|
||||||
gboolean was_mapped;
|
|
||||||
gboolean stop_transitions;
|
gboolean stop_transitions;
|
||||||
gboolean clear_stage_views;
|
gboolean clear_stage_views;
|
||||||
GObject *obj;
|
GObject *obj;
|
||||||
@ -4310,8 +4309,6 @@ clutter_actor_remove_child_internal (ClutterActor *self,
|
|||||||
|
|
||||||
if (check_state)
|
if (check_state)
|
||||||
{
|
{
|
||||||
was_mapped = CLUTTER_ACTOR_IS_MAPPED (child);
|
|
||||||
|
|
||||||
/* we need to unrealize *before* we set parent_actor to NULL,
|
/* we need to unrealize *before* we set parent_actor to NULL,
|
||||||
* because in an unrealize method actors are dissociating from the
|
* because in an unrealize method actors are dissociating from the
|
||||||
* stage, which means they need to be able to
|
* stage, which means they need to be able to
|
||||||
@ -4321,8 +4318,6 @@ clutter_actor_remove_child_internal (ClutterActor *self,
|
|||||||
*/
|
*/
|
||||||
clutter_actor_update_map_state (child, MAP_STATE_MAKE_UNREALIZED);
|
clutter_actor_update_map_state (child, MAP_STATE_MAKE_UNREALIZED);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
was_mapped = FALSE;
|
|
||||||
|
|
||||||
if (flush_queue)
|
if (flush_queue)
|
||||||
{
|
{
|
||||||
@ -4384,12 +4379,6 @@ clutter_actor_remove_child_internal (ClutterActor *self,
|
|||||||
if (emit_parent_set && !CLUTTER_ACTOR_IN_DESTRUCTION (child))
|
if (emit_parent_set && !CLUTTER_ACTOR_IN_DESTRUCTION (child))
|
||||||
g_signal_emit (child, actor_signals[PARENT_SET], 0, self);
|
g_signal_emit (child, actor_signals[PARENT_SET], 0, self);
|
||||||
|
|
||||||
/* if the child was mapped then we need to relayout ourselves to account
|
|
||||||
* for the removed child
|
|
||||||
*/
|
|
||||||
if (was_mapped)
|
|
||||||
clutter_actor_queue_relayout (self);
|
|
||||||
|
|
||||||
/* we need to emit the signal before dropping the reference */
|
/* we need to emit the signal before dropping the reference */
|
||||||
if (emit_actor_removed)
|
if (emit_actor_removed)
|
||||||
_clutter_container_emit_actor_removed (CLUTTER_CONTAINER (self), child);
|
_clutter_container_emit_actor_removed (CLUTTER_CONTAINER (self), child);
|
||||||
@ -12073,29 +12062,6 @@ clutter_actor_add_child_internal (ClutterActor *self,
|
|||||||
if (CLUTTER_ACTOR_IS_MAPPED (child))
|
if (CLUTTER_ACTOR_IS_MAPPED (child))
|
||||||
clutter_actor_queue_redraw (child);
|
clutter_actor_queue_redraw (child);
|
||||||
|
|
||||||
/* maintain the invariant that if an actor needs layout,
|
|
||||||
* its parents do as well
|
|
||||||
*/
|
|
||||||
if (clutter_actor_needs_relayout (child))
|
|
||||||
{
|
|
||||||
/* we work around the short-circuiting we do
|
|
||||||
* in clutter_actor_queue_relayout() since we
|
|
||||||
* want to force a relayout
|
|
||||||
*/
|
|
||||||
child->priv->needs_width_request = TRUE;
|
|
||||||
child->priv->needs_height_request = TRUE;
|
|
||||||
child->priv->needs_allocation = TRUE;
|
|
||||||
|
|
||||||
if (CLUTTER_ACTOR_IS_MAPPED (child))
|
|
||||||
child->priv->needs_paint_volume_update = TRUE;
|
|
||||||
|
|
||||||
/* we only queue a relayout here, because any possible
|
|
||||||
* redraw has already been queued either by show() or
|
|
||||||
* by our call to queue_redraw() above
|
|
||||||
*/
|
|
||||||
_clutter_actor_queue_only_relayout (child->priv->parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (emit_actor_added)
|
if (emit_actor_added)
|
||||||
_clutter_container_emit_actor_added (CLUTTER_CONTAINER (self), child);
|
_clutter_container_emit_actor_added (CLUTTER_CONTAINER (self), child);
|
||||||
|
|
||||||
@ -12570,7 +12536,7 @@ clutter_actor_set_child_above_sibling (ClutterActor *self,
|
|||||||
sibling);
|
sibling);
|
||||||
g_object_unref(child);
|
g_object_unref(child);
|
||||||
|
|
||||||
clutter_actor_queue_redraw_on_parent (child);
|
clutter_actor_queue_relayout (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12617,7 +12583,7 @@ clutter_actor_set_child_below_sibling (ClutterActor *self,
|
|||||||
sibling);
|
sibling);
|
||||||
g_object_unref(child);
|
g_object_unref(child);
|
||||||
|
|
||||||
clutter_actor_queue_redraw_on_parent (child);
|
clutter_actor_queue_relayout (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user