[mutter] clutter: Remove CLUTTER_ACTOR_IN_REPARENT flag
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter: Remove CLUTTER_ACTOR_IN_REPARENT flag
- Date: Thu, 7 May 2020 09:09:56 +0000 (UTC)
commit c38fa4fa5c186f81a5f1ceb86a71c395fe37bf09
Author: Jonas Dreßler <verdre v0yd nl>
Date: Sun May 3 13:55:33 2020 +0200
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
clutter/clutter/clutter-actor.c | 141 +++++++++++++++++---------------------
clutter/clutter/clutter-private.h | 2 -
2 files changed, 62 insertions(+), 81 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index caab97b4e..67ec1b4d4 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -1198,28 +1198,21 @@ clutter_actor_verify_map_state (ClutterActor *self)
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 (priv->parent == NULL)
- {
- 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))
+ if (!CLUTTER_ACTOR_IS_TOPLEVEL (self))
{
- g_warning ("Realized actor %s has an unrealized parent %s",
- _clutter_actor_get_debug_name (self),
- _clutter_actor_get_debug_name (priv->parent));
+ 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",
+ _clutter_actor_get_debug_name (self),
+ _clutter_actor_get_debug_name (priv->parent));
+ }
}
if (CLUTTER_ACTOR_IS_MAPPED (self))
@@ -1228,70 +1221,64 @@ 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 (priv->parent == NULL)
+ if (CLUTTER_ACTOR_IS_TOPLEVEL (self))
{
- if (CLUTTER_ACTOR_IS_TOPLEVEL (self))
- {
- if (!CLUTTER_ACTOR_IS_VISIBLE (self) &&
- !CLUTTER_ACTOR_IN_DESTRUCTION (self))
- {
- g_warning ("Toplevel actor '%s' is mapped "
- "but not visible",
- _clutter_actor_get_debug_name (self));
- }
- }
- else
+ if (!CLUTTER_ACTOR_IS_VISIBLE (self) &&
+ !CLUTTER_ACTOR_IN_DESTRUCTION (self))
{
- g_warning ("Mapped actor '%s' should have a parent",
+ g_warning ("Toplevel actor '%s' is mapped "
+ "but not visible",
_clutter_actor_get_debug_name (self));
}
}
else
{
- ClutterActor *iter = self;
-
- /* check for the enable_paint_unmapped flag on the actor
- * and parents; if the flag is enabled at any point of this
- * branch of the scene graph then all the later checks
- * become pointless
- */
- while (iter != NULL)
- {
- if (iter->priv->enable_paint_unmapped)
- return;
+ g_warning ("Mapped actor '%s' should have a parent",
+ _clutter_actor_get_debug_name (self));
+ }
+ }
+ else
+ {
+ ClutterActor *iter = self;
- iter = iter->priv->parent;
- }
+ /* check for the enable_paint_unmapped flag on the actor
+ * and parents; if the flag is enabled at any point of this
+ * branch of the scene graph then all the later checks
+ * become pointless
+ */
+ while (iter != NULL)
+ {
+ if (iter->priv->enable_paint_unmapped)
+ return;
- if (!CLUTTER_ACTOR_IS_VISIBLE (priv->parent))
- {
- g_warning ("Actor '%s' should not be mapped if parent '%s'"
- "is not visible",
- _clutter_actor_get_debug_name (self),
- _clutter_actor_get_debug_name (priv->parent));
- }
+ iter = iter->priv->parent;
+ }
- if (!CLUTTER_ACTOR_IS_REALIZED (priv->parent))
- {
- g_warning ("Actor '%s' should not be mapped if parent '%s'"
- "is not realized",
- _clutter_actor_get_debug_name (self),
- _clutter_actor_get_debug_name (priv->parent));
- }
+ if (!CLUTTER_ACTOR_IS_VISIBLE (priv->parent))
+ {
+ g_warning ("Actor '%s' should not be mapped if parent '%s'"
+ "is not visible",
+ _clutter_actor_get_debug_name (self),
+ _clutter_actor_get_debug_name (priv->parent));
+ }
- if (!CLUTTER_ACTOR_IS_TOPLEVEL (priv->parent))
- {
- if (!CLUTTER_ACTOR_IS_MAPPED (priv->parent))
- g_warning ("Actor '%s' is mapped but its non-toplevel "
- "parent '%s' is not mapped",
- _clutter_actor_get_debug_name (self),
- _clutter_actor_get_debug_name (priv->parent));
- }
+ if (!CLUTTER_ACTOR_IS_REALIZED (priv->parent))
+ {
+ g_warning ("Actor '%s' should not be mapped if parent '%s'"
+ "is not realized",
+ _clutter_actor_get_debug_name (self),
+ _clutter_actor_get_debug_name (priv->parent));
+ }
+
+ if (!CLUTTER_ACTOR_IS_TOPLEVEL (priv->parent))
+ {
+ if (!CLUTTER_ACTOR_IS_MAPPED (priv->parent))
+ g_warning ("Actor '%s' is mapped but its non-toplevel "
+ "parent '%s' is not mapped",
+ _clutter_actor_get_debug_name (self),
+ _clutter_actor_get_debug_name (priv->parent));
}
}
}
@@ -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);
diff --git a/clutter/clutter/clutter-private.h b/clutter/clutter/clutter-private.h
index e2a139f07..196725fd9 100644
--- a/clutter/clutter/clutter-private.h
+++ b/clutter/clutter/clutter-private.h
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]