2.0: Remove deprecated API from ClutterStage

This commit is contained in:
Emmanuele Bassi 2012-08-24 08:36:35 +01:00
parent 0c5e99429f
commit 6155a1900b
2 changed files with 1 additions and 408 deletions

View File

@ -125,8 +125,6 @@ struct _ClutterStagePrivate
CoglMatrix view;
float viewport[4];
ClutterFog fog;
gchar *title;
ClutterActor *key_focused_actor;
@ -164,7 +162,6 @@ struct _ClutterStagePrivate
guint is_fullscreen : 1;
guint is_cursor_visible : 1;
guint is_user_resizable : 1;
guint use_fog : 1;
guint throttle_motion_events : 1;
guint use_alpha : 1;
guint min_size_changed : 1;
@ -340,23 +337,6 @@ 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,
@ -1625,10 +1605,7 @@ static gboolean
clutter_stage_real_delete_event (ClutterStage *stage,
ClutterEvent *event)
{
if (stage_is_default (stage))
clutter_main_quit ();
else
clutter_actor_destroy (CLUTTER_ACTOR (stage));
clutter_actor_destroy (CLUTTER_ACTOR (stage));
return TRUE;
}
@ -1717,14 +1694,6 @@ clutter_stage_set_property (GObject *object,
clutter_stage_set_user_resizable (stage, g_value_get_boolean (value));
break;
case PROP_USE_FOG:
clutter_stage_set_use_fog (stage, g_value_get_boolean (value));
break;
case PROP_FOG:
clutter_stage_set_fog (stage, g_value_get_boxed (value));
break;
case PROP_USE_ALPHA:
clutter_stage_set_use_alpha (stage, g_value_get_boolean (value));
break;
@ -1791,14 +1760,6 @@ clutter_stage_get_property (GObject *gobject,
g_value_set_boolean (value, priv->is_user_resizable);
break;
case PROP_USE_FOG:
g_value_set_boolean (value, priv->use_fog);
break;
case PROP_FOG:
g_value_set_boxed (value, &priv->fog);
break;
case PROP_USE_ALPHA:
g_value_set_boolean (value, priv->use_alpha);
break;
@ -1932,21 +1893,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
g_object_class_install_property (gobject_class,
PROP_FULLSCREEN_SET,
pspec);
/**
* ClutterStage:offscreen:
*
* Whether the stage should be rendered in an offscreen buffer.
*
* Deprecated: 1.10: This property does not do anything.
*/
pspec = g_param_spec_boolean ("offscreen",
P_("Offscreen"),
P_("Whether the main stage should be rendered offscreen"),
FALSE,
CLUTTER_PARAM_READWRITE | G_PARAM_DEPRECATED);
g_object_class_install_property (gobject_class,
PROP_OFFSCREEN,
pspec);
/**
* ClutterStage:cursor-visible:
*
@ -1975,22 +1921,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
g_object_class_install_property (gobject_class,
PROP_USER_RESIZABLE,
pspec);
/**
* ClutterStage:color:
*
* The background color of the main stage.
*
* Deprecated: 1.10: Use the #ClutterActor:background-color property of
* #ClutterActor instead.
*/
pspec = clutter_param_spec_color ("color",
P_("Color"),
P_("The color of the stage"),
&default_stage_color,
CLUTTER_PARAM_READWRITE |
G_PARAM_DEPRECATED);
g_object_class_install_property (gobject_class, PROP_COLOR, pspec);
/**
* ClutterStage:perspective:
*
@ -2022,41 +1952,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
CLUTTER_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_TITLE, pspec);
/**
* ClutterStage:use-fog:
*
* Whether the stage should use a linear GL "fog" in creating the
* depth-cueing effect, to enhance the perception of depth by fading
* actors farther from the viewpoint.
*
* Since: 0.6
*
* Deprecated: 1.10: This property does not do anything.
*/
pspec = g_param_spec_boolean ("use-fog",
P_("Use Fog"),
P_("Whether to enable depth cueing"),
FALSE,
CLUTTER_PARAM_READWRITE | G_PARAM_DEPRECATED);
g_object_class_install_property (gobject_class, PROP_USE_FOG, pspec);
/**
* ClutterStage:fog:
*
* The settings for the GL "fog", used only if #ClutterStage:use-fog
* is set to %TRUE
*
* Since: 1.0
*
* Deprecated: 1.10: This property does not do anything.
*/
pspec = g_param_spec_boxed ("fog",
P_("Fog"),
P_("Settings for the depth cueing"),
CLUTTER_TYPE_FOG,
CLUTTER_PARAM_READWRITE | G_PARAM_DEPRECATED);
g_object_class_install_property (gobject_class, PROP_FOG, pspec);
/**
* ClutterStage:use-alpha:
*
@ -2279,7 +2174,6 @@ clutter_stage_init (ClutterStage *self)
priv->is_fullscreen = FALSE;
priv->is_user_resizable = FALSE;
priv->is_cursor_visible = TRUE;
priv->use_fog = FALSE;
priv->throttle_motion_events = TRUE;
priv->min_size_changed = FALSE;
priv->sync_delay = -1;
@ -2318,10 +2212,6 @@ clutter_stage_init (ClutterStage *self)
geom.height);
/* FIXME - remove for 2.0 */
priv->fog.z_near = 1.0;
priv->fog.z_far = 2.0;
priv->relayout_pending = TRUE;
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
@ -2344,90 +2234,6 @@ clutter_stage_init (ClutterStage *self)
priv->pick_id_pool = _clutter_id_pool_new (256);
}
/**
* clutter_stage_get_default:
*
* Retrieves a #ClutterStage singleton.
*
* This function is not as useful as it sounds, and will most likely
* by deprecated in the future. Application code should only create
* a #ClutterStage instance using clutter_stage_new(), and manage the
* lifetime of the stage manually.
*
* The default stage singleton has a platform-specific behaviour: on
* platforms without the %CLUTTER_FEATURE_STAGE_MULTIPLE feature flag
* set, the first #ClutterStage instance will also be set to be the
* default stage instance, and this function will always return a
* pointer to it.
*
* On platforms with the %CLUTTER_FEATURE_STAGE_MULTIPLE feature flag
* set, the default stage will be created by the first call to this
* function, and every following call will return the same pointer to
* it.
*
* 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)
{
ClutterStageManager *stage_manager = clutter_stage_manager_get_default ();
ClutterStage *stage;
stage = clutter_stage_manager_get_default_stage (stage_manager);
if (G_UNLIKELY (stage == NULL))
{
/* This will take care of automatically adding the stage to the
* stage manager and setting it as the default. Its floating
* 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));
}
return CLUTTER_ACTOR (stage);
}
/**
* clutter_stage_set_color:
* @stage: A #ClutterStage
* @color: A #ClutterColor
*
* Sets the stage color.
*
* Deprecated: 1.10: Use clutter_actor_set_background_color() instead.
*/
void
clutter_stage_set_color (ClutterStage *stage,
const ClutterColor *color)
{
clutter_actor_set_background_color (CLUTTER_ACTOR (stage), color);
g_object_notify (G_OBJECT (stage), "color");
}
/**
* clutter_stage_get_color:
* @stage: A #ClutterStage
* @color: (out caller-allocates): return location for a #ClutterColor
*
* Retrieves the stage color.
*
* Deprecated: 1.10: Use clutter_actor_get_background_color() instead.
*/
void
clutter_stage_get_color (ClutterStage *stage,
ClutterColor *color)
{
clutter_actor_get_background_color (CLUTTER_ACTOR (stage), color);
}
static void
clutter_stage_set_perspective_internal (ClutterStage *stage,
ClutterPerspective *perspective)
@ -3146,136 +2952,6 @@ clutter_stage_get_key_focus (ClutterStage *stage)
return CLUTTER_ACTOR (stage);
}
/**
* clutter_stage_get_use_fog:
* @stage: the #ClutterStage
*
* Gets whether the depth cueing effect is enabled on @stage.
*
* Return value: %TRUE if the depth cueing effect is enabled
*
* Since: 0.6
*
* Deprecated: 1.10: This function will always return %FALSE
*/
gboolean
clutter_stage_get_use_fog (ClutterStage *stage)
{
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
return stage->priv->use_fog;
}
/**
* clutter_stage_set_use_fog:
* @stage: the #ClutterStage
* @fog: %TRUE for enabling the depth cueing effect
*
* Sets whether the depth cueing effect on the stage should be enabled
* or not.
*
* Depth cueing is a 3D effect that makes actors farther away from the
* viewing point less opaque, by fading them with the stage color.
* The parameters of the GL fog used can be changed using the
* clutter_stage_set_fog() function.
*
* Since: 0.6
*
* Deprecated: 1.10: Calling this function produces no visible effect
*/
void
clutter_stage_set_use_fog (ClutterStage *stage,
gboolean fog)
{
}
/**
* clutter_stage_set_fog:
* @stage: the #ClutterStage
* @fog: a #ClutterFog structure
*
* Sets the fog (also known as "depth cueing") settings for the @stage.
*
* A #ClutterStage will only use a linear fog progression, which
* depends solely on the distance from the viewer. The cogl_set_fog()
* function in COGL exposes more of the underlying implementation,
* and allows changing the for progression function. It can be directly
* used by disabling the #ClutterStage:use-fog property and connecting
* a signal handler to the #ClutterActor::paint signal on the @stage,
* like:
*
* |[
* clutter_stage_set_use_fog (stage, FALSE);
* g_signal_connect (stage, "paint", G_CALLBACK (on_stage_paint), NULL);
* ]|
*
* The paint signal handler will call cogl_set_fog() with the
* desired settings:
*
* |[
* static void
* on_stage_paint (ClutterActor *actor)
* {
* ClutterColor stage_color = { 0, };
* CoglColor fog_color = { 0, };
*
* /* set the fog color to the stage background color */
* clutter_stage_get_color (CLUTTER_STAGE (actor), &stage_color);
* cogl_color_init_from_4ub (&fog_color,
* stage_color.red,
* stage_color.green,
* stage_color.blue,
* stage_color.alpha);
*
* /* enable fog */
* cogl_set_fog (&fog_color,
* COGL_FOG_MODE_EXPONENTIAL, /* mode */
* 0.5, /* density */
* 5.0, 30.0); /* z_near and z_far */
* }
* ]|
*
* <note>The fogging functions only work correctly when the visible actors use
* unmultiplied alpha colors. By default Cogl will premultiply textures and
* cogl_set_source_color() will premultiply colors, so unless you explicitly
* load your textures requesting an unmultiplied internal format and use
* cogl_material_set_color() you can only use fogging with fully opaque actors.
* Support for premultiplied colors will improve in the future when we can
* depend on fragment shaders.</note>
*
* Since: 0.6
*
* Deprecated: 1.10: Fog settings are ignored.
*/
void
clutter_stage_set_fog (ClutterStage *stage,
ClutterFog *fog)
{
}
/**
* clutter_stage_get_fog:
* @stage: the #ClutterStage
* @fog: (out): return location for a #ClutterFog structure
*
* Retrieves the current depth cueing settings from the stage.
*
* Since: 0.6
*
* Deprecated: 1.10: This function will always return the default
* values of #ClutterFog
*/
void
clutter_stage_get_fog (ClutterStage *stage,
ClutterFog *fog)
{
g_return_if_fail (CLUTTER_IS_STAGE (stage));
g_return_if_fail (fog != NULL);
*fog = stage->priv->fog;
}
/*** Perspective boxed type ******/
static gpointer
@ -3298,24 +2974,6 @@ G_DEFINE_BOXED_TYPE (ClutterPerspective, clutter_perspective,
clutter_perspective_copy,
clutter_perspective_free);
static gpointer
clutter_fog_copy (gpointer data)
{
if (G_LIKELY (data))
return g_slice_dup (ClutterFog, data);
return NULL;
}
static void
clutter_fog_free (gpointer data)
{
if (G_LIKELY (data))
g_slice_free (ClutterFog, data);
}
G_DEFINE_BOXED_TYPE (ClutterFog, clutter_fog, clutter_fog_copy, clutter_fog_free);
/**
* clutter_stage_new:
*
@ -3605,50 +3263,6 @@ clutter_stage_ensure_redraw (ClutterStage *stage)
_clutter_master_clock_start_running (master_clock);
}
/**
* clutter_stage_queue_redraw:
* @stage: the #ClutterStage
*
* Queues a redraw for the passed stage.
*
* <note>Applications should call clutter_actor_queue_redraw() and not
* this function.</note>
*
* Since: 0.8
*
* Deprecated: 1.10: Use clutter_actor_queue_redraw() instead.
*/
void
clutter_stage_queue_redraw (ClutterStage *stage)
{
g_return_if_fail (CLUTTER_IS_STAGE (stage));
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
}
/**
* clutter_stage_is_default:
* @stage: a #ClutterStage
*
* Checks if @stage is the default stage, or an instance created using
* clutter_stage_new() but internally using the same implementation.
*
* 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)
{
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
return stage_is_default (stage);
}
void
_clutter_stage_set_window (ClutterStage *stage,
ClutterStageWindow *stage_window)

View File

@ -115,28 +115,7 @@ struct _ClutterPerspective
gfloat z_far;
};
/**
* ClutterFog:
* @z_near: starting distance from the viewer to the near clipping
* plane (always positive)
* @z_far: final distance from the viewer to the far clipping
* plane (always positive)
*
* Fog settings used to create the depth cueing effect.
*
* Since: 0.6
*
* Deprecated: 1.10: The fog-related API in #ClutterStage has been
* deprecated as well.
*/
struct _ClutterFog
{
gfloat z_near;
gfloat z_far;
};
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_new (void);