From 1208e47198ea981b644bca2ce9beab3b59f05d0b Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 9 Dec 2009 02:04:56 +0000 Subject: [PATCH] stage: Add accessors for :use-alpha Use real accessors for the :use-alpha property. --- clutter/clutter-stage.c | 53 +++++++++++++++++++++- clutter/clutter-stage.h | 4 ++ doc/reference/clutter/clutter-sections.txt | 2 + 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index 313cc276d..32eac253f 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -669,8 +669,7 @@ clutter_stage_set_property (GObject *object, break; case PROP_USE_ALPHA: - stage->priv->use_alpha = g_value_get_boolean (value); - clutter_actor_queue_redraw (CLUTTER_ACTOR (stage)); + clutter_stage_set_use_alpha (stage, g_value_get_boolean (value)); break; default: @@ -2164,3 +2163,53 @@ clutter_stage_get_throttle_motion_events (ClutterStage *stage) return stage->priv->throttle_motion_events; } + +/** + * clutter_stage_set_use_alpha: + * @stage: a #ClutterStage + * @use_alpha: whether the stage should honour the opacity or the + * alpha channel of the stage color + * + * Sets whether the @stage should honour the #ClutterActor:opacity and + * the alpha channel of the #ClutterStage:color + * + * Since: 1.2 + */ +void +clutter_stage_set_use_alpha (ClutterStage *stage, + gboolean use_alpha) +{ + ClutterStagePrivate *priv; + + g_return_if_fail (CLUTTER_IS_STAGE (stage)); + + priv = stage->priv; + + if (priv->use_alpha != use_alpha) + { + priv->use_alpha = use_alpha; + + clutter_actor_queue_redraw (CLUTTER_ACTOR (stage)); + + g_object_notify (G_OBJECT (stage), "use-alpha"); + } +} + +/** + * clutter_stage_get_use_alpha: + * @stage: a #ClutterStage + * + * Retrieves the value set using clutter_stage_set_use_alpha() + * + * Return value: %TRUE if the stage should honour the opacity and the + * alpha channel of the stage color + * + * Since: 1.2 + */ +gboolean +clutter_stage_get_use_alpha (ClutterStage *stage) +{ + g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE); + + return stage->priv->use_alpha; +} diff --git a/clutter/clutter-stage.h b/clutter/clutter-stage.h index 59baf5684..095e1f8c9 100644 --- a/clutter/clutter-stage.h +++ b/clutter/clutter-stage.h @@ -247,6 +247,10 @@ void clutter_stage_set_throttle_motion_events (ClutterStage *stage, gboolean throttle); gboolean clutter_stage_get_throttle_motion_events (ClutterStage *stage); +void clutter_stage_set_use_alpha (ClutterStage *stage, + gboolean use_alpha); +gboolean clutter_stage_get_use_alpha (ClutterStage *stage); + /* Commodity macro, for mallum only */ #define clutter_stage_add(stage,actor) G_STMT_START { \ if (CLUTTER_IS_STAGE ((stage)) && CLUTTER_IS_ACTOR ((actor))) \ diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt index d96a6c07d..cb3b06732 100644 --- a/doc/reference/clutter/clutter-sections.txt +++ b/doc/reference/clutter/clutter-sections.txt @@ -522,6 +522,8 @@ clutter_stage_get_key_focus clutter_stage_read_pixels clutter_stage_set_throttle_motion_events clutter_stage_get_throttle_motion_events +clutter_stage_set_use_alpha +clutter_stage_get_use_alpha ClutterPerspective