clutter: Remove CLUTTER_ACTOR_IN_REPARENT flag

The CLUTTER_ACTOR_IN_REPARENT and the CLUTTER_IN_REPARENT flag are never
set and the logic for skipping unmap, unrealize and the emission of the
"parent-set" signal during reparents has been solved differently by
leaving out the CHECK_STATE and EMIT_PARENT_SET flags when calling
add_child_internal() and remove_child_internal().

The only place where those REPARENT flags are theoretically still useful
is in the clutter_actor_verify_map_state() debugging function, but that
is never called during reparent anyway, so simply leave the comment
regarding reparent there.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1228
This commit is contained in:
Jonas Dreßler 2020-05-03 13:55:33 +02:00 committed by Carlos Garnacho
parent 5201d77b0b
commit c38fa4fa5c
2 changed files with 61 additions and 80 deletions

View File

@ -1197,22 +1197,16 @@ clutter_actor_verify_map_state (ClutterActor *self)
ClutterActorPrivate *priv = self->priv;
if (CLUTTER_ACTOR_IS_REALIZED (self))
{
/* all bets are off during reparent when we're potentially realized,
* but should not be according to invariants
*/
if (!CLUTTER_ACTOR_IN_REPARENT (self))
{
if (priv->parent == NULL)
{
if (CLUTTER_ACTOR_IS_TOPLEVEL (self))
if (!CLUTTER_ACTOR_IS_TOPLEVEL (self))
{
}
else
g_warning ("Realized non-toplevel actor '%s' should "
"have a parent",
_clutter_actor_get_debug_name (self));
}
}
else if (!CLUTTER_ACTOR_IS_REALIZED (priv->parent))
{
g_warning ("Realized actor %s has an unrealized parent %s",
@ -1220,7 +1214,6 @@ clutter_actor_verify_map_state (ClutterActor *self)
_clutter_actor_get_debug_name (priv->parent));
}
}
}
if (CLUTTER_ACTOR_IS_MAPPED (self))
{
@ -1228,11 +1221,6 @@ clutter_actor_verify_map_state (ClutterActor *self)
g_warning ("Actor '%s' is mapped but not realized",
_clutter_actor_get_debug_name (self));
/* remaining bets are off during reparent when we're potentially
* mapped, but should not be according to invariants
*/
if (!CLUTTER_ACTOR_IN_REPARENT (self))
{
if (priv->parent == NULL)
{
if (CLUTTER_ACTOR_IS_TOPLEVEL (self))
@ -1294,7 +1282,6 @@ clutter_actor_verify_map_state (ClutterActor *self)
}
}
}
}
}
#endif /* CLUTTER_ENABLE_DEBUG */
@ -1586,13 +1573,10 @@ clutter_actor_update_map_state (ClutterActor *self,
_clutter_actor_get_debug_name (priv->parent));
}
/* If in reparent, we temporarily suspend unmap and unrealize.
*
* We want to go in the order "realize, map" and "unmap, unrealize"
*/
/* We want to go in the order "realize, map" and "unmap, unrealize" */
/* Unmap */
if (!should_be_mapped && !CLUTTER_ACTOR_IN_REPARENT (self))
if (!should_be_mapped)
clutter_actor_set_mapped (self, FALSE);
/* Realize */
@ -1603,7 +1587,7 @@ clutter_actor_update_map_state (ClutterActor *self,
g_assert (!(must_be_realized && !may_be_realized));
/* Unrealize */
if (!may_be_realized && !CLUTTER_ACTOR_IN_REPARENT (self))
if (!may_be_realized)
clutter_actor_unrealize_not_hiding (self);
/* Map */
@ -4578,8 +4562,7 @@ clutter_actor_remove_child_internal (ClutterActor *self,
clutter_actor_queue_compute_expand (self);
}
if (emit_parent_set && !CLUTTER_ACTOR_IN_REPARENT (child) &&
!CLUTTER_ACTOR_IN_DESTRUCTION (child))
if (emit_parent_set && !CLUTTER_ACTOR_IN_DESTRUCTION (child))
{
child->priv->needs_compute_resource_scale = TRUE;
g_signal_emit (child, actor_signals[PARENT_SET], 0, self);
@ -13193,7 +13176,7 @@ clutter_actor_add_child_internal (ClutterActor *self,
clutter_actor_queue_compute_expand (self);
}
if (emit_parent_set && !CLUTTER_ACTOR_IN_REPARENT (child))
if (emit_parent_set)
{
child->priv->needs_compute_resource_scale = TRUE;
g_signal_emit (child, actor_signals[PARENT_SET], 0, NULL);

View File

@ -65,7 +65,6 @@ typedef struct _ClutterVertex4 ClutterVertex4;
#define CLUTTER_ACTOR_IS_TOPLEVEL(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IS_TOPLEVEL) != FALSE)
#define CLUTTER_ACTOR_IN_DESTRUCTION(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_DESTRUCTION) != FALSE)
#define CLUTTER_ACTOR_IN_REPARENT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_REPARENT) != FALSE)
#define CLUTTER_ACTOR_IN_PAINT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE)
#define CLUTTER_ACTOR_IN_PICK(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PICK) != FALSE)
#define CLUTTER_ACTOR_IN_RELAYOUT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RELAYOUT) != FALSE)
@ -99,7 +98,6 @@ typedef enum
CLUTTER_IN_DESTRUCTION = 1 << 0,
CLUTTER_IS_TOPLEVEL = 1 << 1,
CLUTTER_IN_REPARENT = 1 << 2,
CLUTTER_IN_PREF_WIDTH = 1 << 3,
CLUTTER_IN_PREF_HEIGHT = 1 << 4,