diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index f606ec22b..60370f1c8 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -276,6 +276,23 @@ queue_full_redraw (ClutterStage *stage) _clutter_stage_window_add_redraw_clip (stage_window, NULL); } +static gboolean +stage_is_default (ClutterStage *stage) +{ + ClutterStageManager *stage_manager; + ClutterStageWindow *impl; + + stage_manager = clutter_stage_manager_get_default (); + if (stage != clutter_stage_manager_get_default_stage (stage_manager)) + return FALSE; + + impl = _clutter_stage_get_window (stage); + if (impl != _clutter_stage_get_default_window ()) + return FALSE; + + return TRUE; +} + static void clutter_stage_allocate (ClutterActor *self, const ClutterActorBox *box, @@ -1472,7 +1489,7 @@ static gboolean clutter_stage_real_delete_event (ClutterStage *stage, ClutterEvent *event) { - if (clutter_stage_is_default (stage)) + if (stage_is_default (stage)) clutter_main_quit (); else clutter_actor_destroy (CLUTTER_ACTOR (stage)); @@ -2197,6 +2214,8 @@ clutter_stage_init (ClutterStage *self) * Return value: (transfer none) (type Clutter.Stage): the main * #ClutterStage. You should never destroy or unref the returned * actor. + * + * Deprecated: 1.10: Use clutter_stage_new() instead. */ ClutterActor * clutter_stage_get_default (void) @@ -3497,24 +3516,17 @@ clutter_stage_queue_redraw (ClutterStage *stage) * Return value: %TRUE if the passed stage is the default one * * Since: 0.8 + * + * Deprecated: 1.10: Track the stage pointer inside your application + * code, or use clutter_actor_get_stage() to retrieve the stage for + * a given actor. */ gboolean clutter_stage_is_default (ClutterStage *stage) { - ClutterStageManager *stage_manager; - ClutterStageWindow *impl; - g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE); - stage_manager = clutter_stage_manager_get_default (); - if (stage != clutter_stage_manager_get_default_stage (stage_manager)) - return FALSE; - - impl = _clutter_stage_get_window (stage); - if (impl != _clutter_stage_get_default_window ()) - return FALSE; - - return TRUE; + return stage_is_default (stage); } void diff --git a/clutter/clutter-stage.h b/clutter/clutter-stage.h index 4606d5200..6ca0f71de 100644 --- a/clutter/clutter-stage.h +++ b/clutter/clutter-stage.h @@ -146,7 +146,6 @@ GType clutter_perspective_get_type (void) G_GNUC_CONST; GType clutter_fog_get_type (void) G_GNUC_CONST; GType clutter_stage_get_type (void) G_GNUC_CONST; -ClutterActor *clutter_stage_get_default (void); ClutterActor *clutter_stage_new (void); void clutter_stage_set_color (ClutterStage *stage, @@ -194,7 +193,6 @@ void clutter_stage_set_key_focus (ClutterStage *stage, ClutterActor * clutter_stage_get_key_focus (ClutterStage *stage); void clutter_stage_ensure_current (ClutterStage *stage); void clutter_stage_queue_redraw (ClutterStage *stage); -gboolean clutter_stage_is_default (ClutterStage *stage); void clutter_stage_ensure_viewport (ClutterStage *stage); void clutter_stage_ensure_redraw (ClutterStage *stage); diff --git a/clutter/deprecated/clutter-stage.h b/clutter/deprecated/clutter-stage.h index 98d16da76..8d1951afa 100644 --- a/clutter/deprecated/clutter-stage.h +++ b/clutter/deprecated/clutter-stage.h @@ -40,6 +40,12 @@ G_BEGIN_DECLS #endif /* CLUTTER_DISABLE_DEPRECATED */ +CLUTTER_DEPRECATED_FOR(clutter_stage_new) +ClutterActor * clutter_stage_get_default (void); + +CLUTTER_DEPRECATED +gboolean clutter_stage_is_default (ClutterStage *stage); + G_END_DECLS #endif /* __CLUTTER_STAGE_DEPRECATED_H__ */