mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
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
This commit is contained in:
parent
e17d70a592
commit
2773e8adf8
@ -746,9 +746,6 @@ struct _ClutterActorPrivate
|
|||||||
*/
|
*/
|
||||||
ClutterTextDirection text_direction;
|
ClutterTextDirection text_direction;
|
||||||
|
|
||||||
/* a counter used to toggle the CLUTTER_INTERNAL_CHILD flag */
|
|
||||||
gint internal_child;
|
|
||||||
|
|
||||||
/* meta classes */
|
/* meta classes */
|
||||||
ClutterMetaGroup *actions;
|
ClutterMetaGroup *actions;
|
||||||
ClutterMetaGroup *constraints;
|
ClutterMetaGroup *constraints;
|
||||||
@ -6073,18 +6070,7 @@ clutter_actor_dispose (GObject *object)
|
|||||||
if (priv->parent != NULL)
|
if (priv->parent != NULL)
|
||||||
{
|
{
|
||||||
ClutterActor *parent = priv->parent;
|
ClutterActor *parent = priv->parent;
|
||||||
|
clutter_container_remove_actor (CLUTTER_CONTAINER (parent), self);
|
||||||
/* 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parent must be gone at this point */
|
/* parent must be gone at this point */
|
||||||
@ -13099,12 +13085,6 @@ clutter_actor_add_child_internal (ClutterActor *self,
|
|||||||
if (self->priv->in_cloned_branch)
|
if (self->priv->in_cloned_branch)
|
||||||
clutter_actor_push_in_cloned_branch (child, 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
|
/* children may cause their parent to expand, if they are set
|
||||||
* to expand; if a child is not expanded then it cannot change
|
* to expand; if a child is not expanded then it cannot change
|
||||||
* its parent's state. any further change later on will queue
|
* its parent's state. any further change later on will queue
|
||||||
@ -13705,29 +13685,12 @@ clutter_actor_reparent (ClutterActor *self,
|
|||||||
|
|
||||||
if (old_parent != NULL)
|
if (old_parent != NULL)
|
||||||
{
|
{
|
||||||
/* go through the Container implementation if this is a regular
|
/* this will have to call unparent() */
|
||||||
* child and not an internal one
|
clutter_container_remove_actor (CLUTTER_CONTAINER (old_parent), self);
|
||||||
*/
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note, will call set_parent() */
|
/* Note, will call set_parent() */
|
||||||
if (!CLUTTER_ACTOR_IS_INTERNAL_CHILD (self))
|
clutter_container_add_actor (CLUTTER_CONTAINER (new_parent), 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);
|
|
||||||
|
|
||||||
priv->needs_compute_resource_scale = TRUE;
|
priv->needs_compute_resource_scale = TRUE;
|
||||||
|
|
||||||
@ -16799,100 +16762,6 @@ clutter_actor_get_text_direction (ClutterActor *self)
|
|||||||
return priv->text_direction;
|
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:
|
* clutter_actor_has_pointer:
|
||||||
* @self: a #ClutterActor
|
* @self: a #ClutterActor
|
||||||
|
@ -576,9 +576,7 @@ clutter_container_get_children (ClutterContainer *container)
|
|||||||
* @user_data: data to be passed to the function, or %NULL
|
* @user_data: data to be passed to the function, or %NULL
|
||||||
*
|
*
|
||||||
* Calls @callback for each child of @container that was added
|
* Calls @callback for each child of @container that was added
|
||||||
* by the application (with clutter_container_add_actor()). Does
|
* by the application (with clutter_container_add_actor()).
|
||||||
* not iterate over "internal" children that are part of the
|
|
||||||
* container's own implementation, if any.
|
|
||||||
*
|
*
|
||||||
* This function calls the #ClutterContainerIface.foreach()
|
* This function calls the #ClutterContainerIface.foreach()
|
||||||
* virtual function, which has been deprecated.
|
* virtual function, which has been deprecated.
|
||||||
@ -617,52 +615,6 @@ clutter_container_foreach (ClutterContainer *container,
|
|||||||
user_data);
|
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)
|
* clutter_container_raise_child: (virtual raise)
|
||||||
* @container: a #ClutterContainer
|
* @container: a #ClutterContainer
|
||||||
|
@ -61,12 +61,6 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
|
|||||||
* virtual function is deprecated, and it should not be overridden.
|
* virtual function is deprecated, and it should not be overridden.
|
||||||
* @foreach: virtual function for iterating over the container's children.
|
* @foreach: virtual function for iterating over the container's children.
|
||||||
* This virtual function is deprecated, and it should not be overridden.
|
* 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
|
* @raise: virtual function for raising a child. This virtual function is
|
||||||
* deprecated and it should not be overridden.
|
* deprecated and it should not be overridden.
|
||||||
* @lower: virtual function for lowering a child. This virtual function is
|
* @lower: virtual function for lowering a child. This virtual function is
|
||||||
@ -108,10 +102,6 @@ struct _ClutterContainerIface
|
|||||||
ClutterCallback callback,
|
ClutterCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
void (* foreach_with_internals) (ClutterContainer *container,
|
|
||||||
ClutterCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
/* child stacking */
|
/* child stacking */
|
||||||
void (* raise) (ClutterContainer *container,
|
void (* raise) (ClutterContainer *container,
|
||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
|
@ -64,7 +64,6 @@ typedef struct _ClutterVertex4 ClutterVertex4;
|
|||||||
#define CLUTTER_UNSET_PRIVATE_FLAGS(a,f) (CLUTTER_PRIVATE_FLAGS (a) &= ~(f))
|
#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_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_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_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_PAINT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE)
|
||||||
@ -108,9 +107,6 @@ typedef enum
|
|||||||
|
|
||||||
/* Used to avoid recursion */
|
/* Used to avoid recursion */
|
||||||
CLUTTER_IN_RELAYOUT = 1 << 6,
|
CLUTTER_IN_RELAYOUT = 1 << 6,
|
||||||
|
|
||||||
/* a flag for internal children of Containers (DEPRECATED) */
|
|
||||||
CLUTTER_INTERNAL_CHILD = 1 << 7
|
|
||||||
} ClutterPrivateFlags;
|
} ClutterPrivateFlags;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -70,11 +70,6 @@ void clutter_container_foreach (ClutterContaine
|
|||||||
ClutterCallback callback,
|
ClutterCallback callback,
|
||||||
gpointer user_data);
|
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)
|
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_above_sibling)
|
||||||
void clutter_container_raise_child (ClutterContainer *container,
|
void clutter_container_raise_child (ClutterContainer *container,
|
||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
|
@ -60,13 +60,8 @@ test_destroy_remove (ClutterContainer *container,
|
|||||||
clutter_actor_get_name (actor),
|
clutter_actor_get_name (actor),
|
||||||
G_OBJECT_TYPE_NAME (actor));
|
G_OBJECT_TYPE_NAME (actor));
|
||||||
|
|
||||||
g_assert (actor != self->bg);
|
g_assert_true (g_list_find (self->children, actor));
|
||||||
g_assert (actor != self->label);
|
self->children = g_list_remove (self->children, actor);
|
||||||
|
|
||||||
if (!g_list_find (self->children, actor))
|
|
||||||
g_assert (actor == self->tex);
|
|
||||||
else
|
|
||||||
self->children = g_list_remove (self->children, actor);
|
|
||||||
|
|
||||||
clutter_actor_unparent (actor);
|
clutter_actor_unparent (actor);
|
||||||
}
|
}
|
||||||
@ -83,6 +78,8 @@ test_destroy_destroy (ClutterActor *self)
|
|||||||
{
|
{
|
||||||
TestDestroy *test = TEST_DESTROY (self);
|
TestDestroy *test = TEST_DESTROY (self);
|
||||||
|
|
||||||
|
g_assert_cmpuint (g_list_length (test->children), ==, 4);
|
||||||
|
|
||||||
if (test->bg != NULL)
|
if (test->bg != NULL)
|
||||||
{
|
{
|
||||||
if (g_test_verbose ())
|
if (g_test_verbose ())
|
||||||
@ -116,7 +113,7 @@ test_destroy_destroy (ClutterActor *self)
|
|||||||
test->tex = NULL;
|
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)
|
if (CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy)
|
||||||
CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy (self);
|
CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy (self);
|
||||||
@ -135,23 +132,16 @@ test_destroy_class_init (TestDestroyClass *klass)
|
|||||||
static void
|
static void
|
||||||
test_destroy_init (TestDestroy *self)
|
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 ();
|
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");
|
clutter_actor_set_name (self->bg, "Background");
|
||||||
|
|
||||||
self->label = clutter_text_new ();
|
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_set_name (self->label, "Label");
|
||||||
|
|
||||||
clutter_actor_pop_internal (CLUTTER_ACTOR (self));
|
|
||||||
|
|
||||||
self->tex = clutter_texture_new ();
|
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");
|
clutter_actor_set_name (self->tex, "Texture");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user