diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h index fab17d6ec..5800334c5 100644 --- a/clutter/clutter-private.h +++ b/clutter/clutter-private.h @@ -216,10 +216,12 @@ void _clutter_input_device_set_actor (ClutterInputDevice *device, ClutterActor *_clutter_input_device_update (ClutterInputDevice *device); /* stage manager */ -void _clutter_stage_manager_add_stage (ClutterStageManager *stage_manager, - ClutterStage *stage); -void _clutter_stage_manager_remove_stage (ClutterStageManager *stage_manager, - ClutterStage *stage); +void _clutter_stage_manager_add_stage (ClutterStageManager *stage_manager, + ClutterStage *stage); +void _clutter_stage_manager_remove_stage (ClutterStageManager *stage_manager, + ClutterStage *stage); +void _clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager, + ClutterStage *stage); /* stage */ void _clutter_stage_set_window (ClutterStage *stage, diff --git a/clutter/clutter-stage-manager.c b/clutter/clutter-stage-manager.c index 2ce63f617..0a1fda6f2 100644 --- a/clutter/clutter-stage-manager.c +++ b/clutter/clutter-stage-manager.c @@ -212,6 +212,31 @@ clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager, { } +/* + * _clutter_stage_manager_set_default_stage: + * @stage_manager: a #ClutterStageManager + * @stage: a #ClutterStage + * + * Sets @stage as the default stage + * + * A no-op if there already is a default stage + * + * This is called by clutter_stage_get_default() and should be removed + * along with #ClutterStageManager:default-stage when we stop having + * the default stage + */ +void +_clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager, + ClutterStage *stage) +{ + if (G_UNLIKELY (default_stage == NULL)) + { + default_stage = stage; + + g_object_notify (G_OBJECT (stage_manager), "default-stage"); + } +} + /** * clutter_stage_manager_get_default_stage: * @stage_manager: a #ClutterStageManager @@ -281,13 +306,6 @@ _clutter_stage_manager_add_stage (ClutterStageManager *stage_manager, stage_manager->stages = g_slist_append (stage_manager->stages, stage); - if (G_UNLIKELY (default_stage == NULL)) - { - default_stage = stage; - - g_object_notify (G_OBJECT (stage_manager), "default-stage"); - } - g_signal_emit (stage_manager, manager_signals[STAGE_ADDED], 0, stage); } diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index 9d1daa7db..0b08509eb 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -1217,6 +1217,7 @@ clutter_stage_get_default (void) * reference will be claimed by the stage manager. */ stage = g_object_new (CLUTTER_TYPE_STAGE, NULL); + _clutter_stage_manager_set_default_stage (stage_manager, stage); /* the default stage is realized by default */ clutter_actor_realize (CLUTTER_ACTOR (stage));