From 5cc8687e7ea34e1f78365bc5ff88fbdb6649659a Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 23 May 2008 09:42:32 +0000 Subject: [PATCH] 2008-05-23 Emmanuele Bassi Bug #928 - Reparenting a child that itself is a container doesn't work * clutter/clutter-actor.c (clutter_actor_set_parent): Realize an actor when setting its parent, if the parent is realized. * clutter/clutter-group.c: (clutter_group_realize), (clutter_group_class_init): Add the missing implementation of the ::realize() virtual function; this makes sure that the children of a Group are realized if the Group is realized. (#928) --- ChangeLog | 14 ++++++++++++++ clutter/clutter-actor.c | 7 +++---- clutter/clutter-group.c | 9 +++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3fd00929..1a244a0f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2008-05-23 Emmanuele Bassi + + Bug #928 - Reparenting a child that itself is a container + doesn't work + + * clutter/clutter-actor.c (clutter_actor_set_parent): Realize + an actor when setting its parent, if the parent is realized. + + * clutter/clutter-group.c: + (clutter_group_realize), (clutter_group_class_init): Add the + missing implementation of the ::realize() virtual function; this + makes sure that the children of a Group are realized if the Group + is realized. (#928) + 2008-05-21 Neil Roberts * clutter/cogl/gl/cogl.c (error_string): diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 9cec17f49..f0b89300d 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -4205,13 +4205,12 @@ clutter_actor_set_parent (ClutterActor *self, self->priv->parent_actor = parent; g_signal_emit (self, actor_signals[PARENT_SET], 0, NULL); - if (self->priv->show_on_set_parent == TRUE) - clutter_actor_show (self); - - /* FIXME: below likely not needed */ if (CLUTTER_ACTOR_IS_REALIZED (self->priv->parent_actor)) clutter_actor_realize (self); + if (self->priv->show_on_set_parent) + clutter_actor_show (self); + if (CLUTTER_ACTOR_IS_VISIBLE (self->priv->parent_actor) && CLUTTER_ACTOR_IS_VISIBLE (self)) { diff --git a/clutter/clutter-group.c b/clutter/clutter-group.c index a91743fb6..c215d2aba 100644 --- a/clutter/clutter-group.c +++ b/clutter/clutter-group.c @@ -107,6 +107,14 @@ clutter_group_paint (ClutterActor *actor) CLUTTER_NOTE (PAINT, "ClutterGroup paint leave"); } +static void +clutter_group_realize (ClutterActor *actor) +{ + clutter_container_foreach (CLUTTER_CONTAINER (actor), + CLUTTER_CALLBACK (clutter_actor_realize), + NULL); +} + static void clutter_group_unrealize (ClutterActor *actor) { @@ -453,6 +461,7 @@ clutter_group_class_init (ClutterGroupClass *klass) actor_class->hide_all = clutter_group_real_hide_all; actor_class->request_coords = clutter_group_request_coords; actor_class->query_coords = clutter_group_query_coords; + actor_class->realize = clutter_group_realize; actor_class->unrealize = clutter_group_unrealize; /**