From 720fbd3bec522f200396f206242bc76285492f15 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 5 Mar 2012 17:38:27 +0000 Subject: [PATCH] stage: Fix up a copy-and-paste train wreck The show and hide implementation inside ClutterStage ended up being recursive, and the hide implementation would actually show the children of the stage unconditionally. Whoopsie. --- clutter/clutter-stage.c | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index a9ab25a6b..123caeb09 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -790,16 +790,26 @@ clutter_stage_unrealize (ClutterActor *self) } static void -clutter_stage_show (ClutterActor *self) +clutter_stage_show_all (ClutterActor *self) { - ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv; ClutterActorIter iter; ClutterActor *child; + /* we don't do a recursive show_all(), to maintain the old + * invariants from ClutterGroup + */ clutter_actor_iter_init (&iter, self); while (clutter_actor_iter_next (&iter, &child)) clutter_actor_show (child); + clutter_actor_show (self); +} + +static void +clutter_stage_show (ClutterActor *self) +{ + ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv; + CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->show (self); /* Possibly do an allocation run so that the stage will have the @@ -811,18 +821,28 @@ clutter_stage_show (ClutterActor *self) } static void -clutter_stage_hide (ClutterActor *self) +clutter_stage_hide_all (ClutterActor *self) { - ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv; ClutterActorIter iter; ClutterActor *child; - g_assert (priv->impl != NULL); - _clutter_stage_window_hide (priv->impl); + clutter_actor_hide (self); + /* we don't do a recursive hide_all(), to maintain the old invariants + * from ClutterGroup + */ clutter_actor_iter_init (&iter, self); while (clutter_actor_iter_next (&iter, &child)) - clutter_actor_show (child); + clutter_actor_hide (child); +} + +static void +clutter_stage_hide (ClutterActor *self) +{ + ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv; + + g_assert (priv->impl != NULL); + _clutter_stage_window_hide (priv->impl); CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->hide (self); } @@ -1844,7 +1864,9 @@ clutter_stage_class_init (ClutterStageClass *klass) actor_class->realize = clutter_stage_realize; actor_class->unrealize = clutter_stage_unrealize; actor_class->show = clutter_stage_show; + actor_class->show_all = clutter_stage_show_all; actor_class->hide = clutter_stage_hide; + actor_class->hide_all = clutter_stage_hide_all; actor_class->queue_relayout = clutter_stage_real_queue_relayout; actor_class->queue_redraw = clutter_stage_real_queue_redraw; actor_class->apply_transform = clutter_stage_real_apply_transform;