[mutter] clutter/actor: Remove deprecated internal child support
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/actor: Remove deprecated internal child support
- Date: Tue, 15 Oct 2019 09:00:23 +0000 (UTC)
commit 2773e8adf83c8fa769b89bf1fc1f03768255b8bc
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date: Tue Sep 10 02:22:07 2019 +0200
clutter/actor: Remove deprecated internal child support
Clutter had support for internal children in its early revisions, but they
were deprecated for long time (commit f41061b8df, more than 7 years ago) and
no one is using them in both clutter and in gnome-shell.
So remove any alternative code path that uses internal children.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/816
clutter/clutter/clutter-actor.c | 139 +------------------------
clutter/clutter/clutter-container.c | 50 +--------
clutter/clutter/clutter-container.h | 10 --
clutter/clutter/clutter-private.h | 4 -
clutter/clutter/deprecated/clutter-container.h | 5 -
src/tests/clutter/conform/actor-destroy.c | 26 ++---
6 files changed, 13 insertions(+), 221 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index e763291a5..e94570812 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -746,9 +746,6 @@ struct _ClutterActorPrivate
*/
ClutterTextDirection text_direction;
- /* a counter used to toggle the CLUTTER_INTERNAL_CHILD flag */
- gint internal_child;
-
/* meta classes */
ClutterMetaGroup *actions;
ClutterMetaGroup *constraints;
@@ -6073,18 +6070,7 @@ clutter_actor_dispose (GObject *object)
if (priv->parent != NULL)
{
ClutterActor *parent = priv->parent;
-
- /* go through the Container implementation unless this
- * is an internal child and has been marked as such.
- *
- * removing the actor from its parent will reset the
- * realized and mapped states.
- */
- if (!CLUTTER_ACTOR_IS_INTERNAL_CHILD (self))
- clutter_container_remove_actor (CLUTTER_CONTAINER (parent), self);
- else
- clutter_actor_remove_child_internal (parent, self,
- REMOVE_CHILD_LEGACY_FLAGS);
+ clutter_container_remove_actor (CLUTTER_CONTAINER (parent), self);
}
/* parent must be gone at this point */
@@ -13099,12 +13085,6 @@ clutter_actor_add_child_internal (ClutterActor *self,
if (self->priv->in_cloned_branch)
clutter_actor_push_in_cloned_branch (child, self->priv->in_cloned_branch);
- /* if push_internal() has been called then we automatically set
- * the flag on the actor
- */
- if (self->priv->internal_child)
- CLUTTER_SET_PRIVATE_FLAGS (child, CLUTTER_INTERNAL_CHILD);
-
/* children may cause their parent to expand, if they are set
* to expand; if a child is not expanded then it cannot change
* its parent's state. any further change later on will queue
@@ -13705,29 +13685,12 @@ clutter_actor_reparent (ClutterActor *self,
if (old_parent != NULL)
{
- /* go through the Container implementation if this is a regular
- * child and not an internal one
- */
- if (!CLUTTER_ACTOR_IS_INTERNAL_CHILD (self))
- {
- ClutterContainer *parent = CLUTTER_CONTAINER (old_parent);
-
- /* this will have to call unparent() */
- clutter_container_remove_actor (parent, self);
- }
- else
- clutter_actor_remove_child_internal (old_parent, self,
- REMOVE_CHILD_LEGACY_FLAGS);
+ /* this will have to call unparent() */
+ clutter_container_remove_actor (CLUTTER_CONTAINER (old_parent), self);
}
/* Note, will call set_parent() */
- if (!CLUTTER_ACTOR_IS_INTERNAL_CHILD (self))
- clutter_container_add_actor (CLUTTER_CONTAINER (new_parent), self);
- else
- clutter_actor_add_child_internal (new_parent, self,
- ADD_CHILD_LEGACY_FLAGS,
- insert_child_at_depth,
- NULL);
+ clutter_container_add_actor (CLUTTER_CONTAINER (new_parent), self);
priv->needs_compute_resource_scale = TRUE;
@@ -16799,100 +16762,6 @@ clutter_actor_get_text_direction (ClutterActor *self)
return priv->text_direction;
}
-/**
- * clutter_actor_push_internal:
- * @self: a #ClutterActor
- *
- * Should be used by actors implementing the #ClutterContainer and with
- * internal children added through clutter_actor_set_parent(), for instance:
- *
- * |[<!-- language="C" -->
- * static void
- * my_actor_init (MyActor *self)
- * {
- * self->priv = my_actor_get_instance_private (self);
- *
- * clutter_actor_push_internal (CLUTTER_ACTOR (self));
- *
- * // calling clutter_actor_set_parent() now will result in
- * // the internal flag being set on a child of MyActor
- *
- * // internal child - a background texture
- * self->priv->background_tex = clutter_texture_new ();
- * clutter_actor_set_parent (self->priv->background_tex,
- * CLUTTER_ACTOR (self));
- *
- * // internal child - a label
- * self->priv->label = clutter_text_new ();
- * clutter_actor_set_parent (self->priv->label,
- * CLUTTER_ACTOR (self));
- *
- * clutter_actor_pop_internal (CLUTTER_ACTOR (self));
- *
- * // calling clutter_actor_set_parent() now will not result in
- * // the internal flag being set on a child of MyActor
- * }
- * ]|
- *
- * This function will be used by Clutter to toggle an "internal child"
- * flag whenever clutter_actor_set_parent() is called; internal children
- * are handled differently by Clutter, specifically when destroying their
- * parent.
- *
- * Call clutter_actor_pop_internal() when you finished adding internal
- * children.
- *
- * Nested calls to clutter_actor_push_internal() are allowed, but each
- * one must by followed by a clutter_actor_pop_internal() call.
- *
- * Since: 1.2
- *
- * Deprecated: 1.10: All children of an actor are accessible through
- * the #ClutterActor API, and #ClutterActor implements the
- * #ClutterContainer interface, so this function is only useful
- * for legacy containers overriding the default implementation.
- */
-void
-clutter_actor_push_internal (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- self->priv->internal_child += 1;
-}
-
-/**
- * clutter_actor_pop_internal:
- * @self: a #ClutterActor
- *
- * Disables the effects of clutter_actor_push_internal().
- *
- * Since: 1.2
- *
- * Deprecated: 1.10: All children of an actor are accessible through
- * the #ClutterActor API. This function is only useful for legacy
- * containers overriding the default implementation of the
- * #ClutterContainer interface.
- */
-void
-clutter_actor_pop_internal (ClutterActor *self)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- if (priv->internal_child == 0)
- {
- g_warning ("Mismatched %s: you need to call "
- "clutter_actor_push_composite() at least once before "
- "calling this function", G_STRFUNC);
- return;
- }
-
- priv->internal_child -= 1;
-}
-
/**
* clutter_actor_has_pointer:
* @self: a #ClutterActor
diff --git a/clutter/clutter/clutter-container.c b/clutter/clutter/clutter-container.c
index 1e6d49c6a..78f8a24a3 100644
--- a/clutter/clutter/clutter-container.c
+++ b/clutter/clutter/clutter-container.c
@@ -576,9 +576,7 @@ clutter_container_get_children (ClutterContainer *container)
* @user_data: data to be passed to the function, or %NULL
*
* Calls @callback for each child of @container that was added
- * by the application (with clutter_container_add_actor()). Does
- * not iterate over "internal" children that are part of the
- * container's own implementation, if any.
+ * by the application (with clutter_container_add_actor()).
*
* This function calls the #ClutterContainerIface.foreach()
* virtual function, which has been deprecated.
@@ -617,52 +615,6 @@ clutter_container_foreach (ClutterContainer *container,
user_data);
}
-/**
- * clutter_container_foreach_with_internals:
- * @container: a #ClutterContainer
- * @callback: (scope call): a function to be called for each child
- * @user_data: data to be passed to the function, or %NULL
- *
- * Calls @callback for each child of @container, including "internal"
- * children built in to the container itself that were never added
- * by the application.
- *
- * This function calls the #ClutterContainerIface.foreach_with_internals()
- * virtual function, which has been deprecated.
- *
- * Since: 1.0
- *
- * Deprecated: 1.10: See clutter_container_foreach().
- */
-void
-clutter_container_foreach_with_internals (ClutterContainer *container,
- ClutterCallback callback,
- gpointer user_data)
-{
- ClutterContainerIface *iface;
-
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (callback != NULL);
-
- iface = CLUTTER_CONTAINER_GET_IFACE (container);
-
-#ifdef CLUTTER_ENABLE_DEBUG
- if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
- {
- if (iface->foreach_with_internals != NULL)
- _clutter_diagnostic_message ("The ClutterContainer::foreach_with_internals() "
- "virtual function has been deprecated "
- "and it should not be overridden by "
- "newly written code");
- }
-#endif /* CLUTTER_ENABLE_DEBUG */
-
- if (iface->foreach_with_internals != NULL)
- iface->foreach_with_internals (container, callback, user_data);
- else
- iface->foreach (container, callback, user_data);
-}
-
/**
* clutter_container_raise_child: (virtual raise)
* @container: a #ClutterContainer
diff --git a/clutter/clutter/clutter-container.h b/clutter/clutter/clutter-container.h
index 8a0708ff2..02107394f 100644
--- a/clutter/clutter/clutter-container.h
+++ b/clutter/clutter/clutter-container.h
@@ -61,12 +61,6 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
* virtual function is deprecated, and it should not be overridden.
* @foreach: virtual function for iterating over the container's children.
* This virtual function is deprecated, and it should not be overridden.
- * @foreach_with_internals: virtual functions for iterating over the
- * container's children, both added using the #ClutterContainer API
- * and internal children. The implementation of this virtual function
- * is required only if the #ClutterContainer implementation has
- * internal children. This virtual function is deprecated, and it should
- * not be overridden.
* @raise: virtual function for raising a child. This virtual function is
* deprecated and it should not be overridden.
* @lower: virtual function for lowering a child. This virtual function is
@@ -108,10 +102,6 @@ struct _ClutterContainerIface
ClutterCallback callback,
gpointer user_data);
- void (* foreach_with_internals) (ClutterContainer *container,
- ClutterCallback callback,
- gpointer user_data);
-
/* child stacking */
void (* raise) (ClutterContainer *container,
ClutterActor *actor,
diff --git a/clutter/clutter/clutter-private.h b/clutter/clutter/clutter-private.h
index d1da84c8e..fb94bfa07 100644
--- a/clutter/clutter/clutter-private.h
+++ b/clutter/clutter/clutter-private.h
@@ -64,7 +64,6 @@ typedef struct _ClutterVertex4 ClutterVertex4;
#define CLUTTER_UNSET_PRIVATE_FLAGS(a,f) (CLUTTER_PRIVATE_FLAGS (a) &= ~(f))
#define CLUTTER_ACTOR_IS_TOPLEVEL(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IS_TOPLEVEL) != FALSE)
-#define CLUTTER_ACTOR_IS_INTERNAL_CHILD(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_INTERNAL_CHILD) !=
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)
@@ -108,9 +107,6 @@ typedef enum
/* Used to avoid recursion */
CLUTTER_IN_RELAYOUT = 1 << 6,
-
- /* a flag for internal children of Containers (DEPRECATED) */
- CLUTTER_INTERNAL_CHILD = 1 << 7
} ClutterPrivateFlags;
/*
diff --git a/clutter/clutter/deprecated/clutter-container.h b/clutter/clutter/deprecated/clutter-container.h
index 0be03b26b..545bf3b2b 100644
--- a/clutter/clutter/deprecated/clutter-container.h
+++ b/clutter/clutter/deprecated/clutter-container.h
@@ -70,11 +70,6 @@ void clutter_container_foreach (ClutterContaine
ClutterCallback callback,
gpointer user_data);
-CLUTTER_DEPRECATED
-void clutter_container_foreach_with_internals (ClutterContainer *container,
- ClutterCallback callback,
- gpointer user_data);
-
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_above_sibling)
void clutter_container_raise_child (ClutterContainer *container,
ClutterActor *actor,
diff --git a/src/tests/clutter/conform/actor-destroy.c b/src/tests/clutter/conform/actor-destroy.c
index 8a67456c2..54d72d21c 100644
--- a/src/tests/clutter/conform/actor-destroy.c
+++ b/src/tests/clutter/conform/actor-destroy.c
@@ -60,13 +60,8 @@ test_destroy_remove (ClutterContainer *container,
clutter_actor_get_name (actor),
G_OBJECT_TYPE_NAME (actor));
- g_assert (actor != self->bg);
- g_assert (actor != self->label);
-
- if (!g_list_find (self->children, actor))
- g_assert (actor == self->tex);
- else
- self->children = g_list_remove (self->children, actor);
+ g_assert_true (g_list_find (self->children, actor));
+ self->children = g_list_remove (self->children, actor);
clutter_actor_unparent (actor);
}
@@ -83,6 +78,8 @@ test_destroy_destroy (ClutterActor *self)
{
TestDestroy *test = TEST_DESTROY (self);
+ g_assert_cmpuint (g_list_length (test->children), ==, 4);
+
if (test->bg != NULL)
{
if (g_test_verbose ())
@@ -116,7 +113,7 @@ test_destroy_destroy (ClutterActor *self)
test->tex = NULL;
}
- g_assert_nonnull (test->children);
+ g_assert_cmpuint (g_list_length (test->children), ==, 1);
if (CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy)
CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy (self);
@@ -135,23 +132,16 @@ test_destroy_class_init (TestDestroyClass *klass)
static void
test_destroy_init (TestDestroy *self)
{
- clutter_actor_push_internal (CLUTTER_ACTOR (self));
-
- if (g_test_verbose ())
- g_print ("Adding internal children...\n");
-
self->bg = clutter_rectangle_new ();
- clutter_actor_set_parent (self->bg, CLUTTER_ACTOR (self));
+ clutter_container_add_actor (CLUTTER_CONTAINER (self), self->bg);
clutter_actor_set_name (self->bg, "Background");
self->label = clutter_text_new ();
- clutter_actor_set_parent (self->label, CLUTTER_ACTOR (self));
+ clutter_container_add_actor (CLUTTER_CONTAINER (self), self->label);
clutter_actor_set_name (self->label, "Label");
- clutter_actor_pop_internal (CLUTTER_ACTOR (self));
-
self->tex = clutter_texture_new ();
- clutter_actor_set_parent (self->tex, CLUTTER_ACTOR (self));
+ clutter_container_add_actor (CLUTTER_CONTAINER (self), self->tex);
clutter_actor_set_name (self->tex, "Texture");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]