1
0
Fork 0

2.0: Remove deprecated symbols from the tree

And fix the fallout.
This commit is contained in:
Emmanuele Bassi 2012-10-07 21:48:02 +01:00
parent 408d29bfde
commit 93b965f71d
79 changed files with 30 additions and 29157 deletions

View file

@ -30,38 +30,6 @@
G_BEGIN_DECLS
/**
* ClutterGravity:
* @CLUTTER_GRAVITY_NONE: Do not apply any gravity
* @CLUTTER_GRAVITY_NORTH: Scale from topmost downwards
* @CLUTTER_GRAVITY_NORTH_EAST: Scale from the top right corner
* @CLUTTER_GRAVITY_EAST: Scale from the right side
* @CLUTTER_GRAVITY_SOUTH_EAST: Scale from the bottom right corner
* @CLUTTER_GRAVITY_SOUTH: Scale from the bottom upwards
* @CLUTTER_GRAVITY_SOUTH_WEST: Scale from the bottom left corner
* @CLUTTER_GRAVITY_WEST: Scale from the left side
* @CLUTTER_GRAVITY_NORTH_WEST: Scale from the top left corner
* @CLUTTER_GRAVITY_CENTER: Scale from the center.
*
* Gravity of the scaling operations. When a gravity different than
* %CLUTTER_GRAVITY_NONE is used, an actor is scaled keeping the position
* of the specified portion at the same coordinates.
*
*
*/
typedef enum { /*< prefix=CLUTTER_GRAVITY >*/
CLUTTER_GRAVITY_NONE = 0,
CLUTTER_GRAVITY_NORTH,
CLUTTER_GRAVITY_NORTH_EAST,
CLUTTER_GRAVITY_EAST,
CLUTTER_GRAVITY_SOUTH_EAST,
CLUTTER_GRAVITY_SOUTH,
CLUTTER_GRAVITY_SOUTH_WEST,
CLUTTER_GRAVITY_WEST,
CLUTTER_GRAVITY_NORTH_WEST,
CLUTTER_GRAVITY_CENTER
} ClutterGravity;
/**
* ClutterRotateAxis:
* @CLUTTER_X_AXIS: Rotate around the X axis
@ -161,37 +129,31 @@ typedef enum { /*< prefix=CLUTTER_REQUEST >*/
* @CLUTTER_EASE_IN_OUT_BOUNCE: exponentially decaying parabolic (bounce)
* tweening, with bounce on both ends
* @CLUTTER_STEPS: parametrized step function; see clutter_timeline_set_step_progress()
* for further details. (Since 1.12)
* for further details.
* @CLUTTER_STEP_START: equivalent to %CLUTTER_STEPS with a number of steps
* equal to 1, and a step mode of %CLUTTER_STEP_MODE_START. (Since 1.12)
* equal to 1, and a step mode of %CLUTTER_STEP_MODE_START.
* @CLUTTER_STEP_END: equivalent to %CLUTTER_STEPS with a number of steps
* equal to 1, and a step mode of %CLUTTER_STEP_MODE_END. (Since 1.12)
* equal to 1, and a step mode of %CLUTTER_STEP_MODE_END.
* @CLUTTER_CUBIC_BEZIER: cubic bezier between (0, 0) and (1, 1) with two
* control points; see clutter_timeline_set_cubic_bezier_progress(). (Since 1.12)
* control points; see clutter_timeline_set_cubic_bezier_progress().
* @CLUTTER_EASE: equivalent to %CLUTTER_CUBIC_BEZIER with control points
* in (0.25, 0.1) and (0.25, 1.0). (Since 1.12)
* in (0.25, 0.1) and (0.25, 1.0).
* @CLUTTER_EASE_IN: equivalent to %CLUTTER_CUBIC_BEZIER with control points
* in (0.42, 0) and (1.0, 1.0). (Since 1.12)
* in (0.42, 0) and (1.0, 1.0).
* @CLUTTER_EASE_OUT: equivalent to %CLUTTER_CUBIC_BEZIER with control points
* in (0, 0) and (0.58, 1.0). (Since 1.12)
* in (0, 0) and (0.58, 1.0).
* @CLUTTER_EASE_IN_OUT: equivalent to %CLUTTER_CUBIC_BEZIER with control points
* in (0.42, 0) and (0.58, 1.0). (Since 1.12)
* @CLUTTER_ANIMATION_LAST: last animation mode, used as a guard for
* registered global alpha functions
* in (0.42, 0) and (0.58, 1.0).
* @CLUTTER_ANIMATION_LAST: last animation mode, used as a guard when enumerating
*
* The animation modes used by #ClutterAlpha and #ClutterAnimation. This
* enumeration can be expanded in later versions of Clutter.
* The animation modes used by #ClutterTimeline.
*
* This enumeration can be expanded in later versions of Clutter.
*
* <figure id="easing-modes">
* <title>Easing modes provided by Clutter</title>
* <graphic fileref="easing-modes.png" format="PNG"/>
* </figure>
*
* Every global alpha function registered using clutter_alpha_register_func()
* or clutter_alpha_register_closure() will have a logical id greater than
* %CLUTTER_ANIMATION_LAST.
*
*
*/
typedef enum {
CLUTTER_CUSTOM_MODE = 0,
@ -261,7 +223,7 @@ typedef enum {
CLUTTER_EASE_OUT,
CLUTTER_EASE_IN_OUT,
/* guard, before registered alpha functions */
/* guard */
CLUTTER_ANIMATION_LAST
} ClutterAnimationMode;
@ -452,20 +414,6 @@ typedef enum { /*< prefix=CLUTTER_ALIGN >*/
CLUTTER_ALIGN_BOTH
} ClutterAlignAxis;
/**
* ClutterInterpolation:
* @CLUTTER_INTERPOLATION_LINEAR: linear interpolation
* @CLUTTER_INTERPOLATION_CUBIC: cubic interpolation
*
* The mode of interpolation between key frames
*
*
*/
typedef enum {
CLUTTER_INTERPOLATION_LINEAR,
CLUTTER_INTERPOLATION_CUBIC
} ClutterInterpolation;
/**
* ClutterBindCoordinate:
* @CLUTTER_BIND_X: Bind the X coordinate

View file

@ -1,95 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_GROUP_H__
#define __CLUTTER_GROUP_H__
#include <glib-object.h>
#include <clutter/clutter-types.h>
#include <clutter/clutter-actor.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_GROUP (clutter_group_get_type ())
#define CLUTTER_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_GROUP, ClutterGroup))
#define CLUTTER_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_GROUP, ClutterGroupClass))
#define CLUTTER_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_GROUP))
#define CLUTTER_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_GROUP))
#define CLUTTER_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_GROUP, ClutterGroupClass))
/* XXX - ClutterGroup is to be considered fully deprecated; the only
* reason we keep this header is because ClutterStage inherits from
* ClutterGroup, and thus we need to have a structure definition for
* the Stage object to expand.
*/
typedef struct _ClutterGroup ClutterGroup;
typedef struct _ClutterGroupClass ClutterGroupClass;
typedef struct _ClutterGroupPrivate ClutterGroupPrivate;
/**
* ClutterGroup:
*
* The #ClutterGroup structure contains only private data
* and should be accessed using the provided API
*
*
*/
struct _ClutterGroup
{
/*< private >*/
ClutterActor parent_instance;
ClutterGroupPrivate *priv;
};
/**
* ClutterGroupClass:
*
* The #ClutterGroupClass structure contains only private data
*
*
*/
struct _ClutterGroupClass
{
/*< private >*/
ClutterActorClass parent_class;
/* padding for future expansion */
void (*_clutter_reserved1) (void);
void (*_clutter_reserved2) (void);
void (*_clutter_reserved3) (void);
void (*_clutter_reserved4) (void);
void (*_clutter_reserved5) (void);
void (*_clutter_reserved6) (void);
};
GType clutter_group_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __CLUTTER_GROUP_H__ */

View file

@ -467,6 +467,14 @@ _clutter_context_get_show_fps (void)
return context->show_fps;
}
guint
_clutter_context_get_frame_rate (void)
{
ClutterMainContext *context = _clutter_context_get_default ();
return context->frame_rate;
}
/**
* clutter_get_accessibility_enabled:
*
@ -2635,25 +2643,6 @@ clutter_base_init (void)
}
}
/**
* clutter_get_default_frame_rate:
*
* Retrieves the default frame rate. See clutter_set_default_frame_rate().
*
* Return value: the default frame rate
*
*
*/
guint
clutter_get_default_frame_rate (void)
{
ClutterMainContext *context;
context = _clutter_context_get_default ();
return context->frame_rate;
}
static void
on_grab_actor_destroy (ClutterActor *actor,
ClutterInputDevice *device)

View file

@ -141,8 +141,6 @@ PangoFontMap * clutter_get_font_map (void);
ClutterTextDirection clutter_get_default_text_direction (void);
guint clutter_get_default_frame_rate (void);
G_END_DECLS
#endif /* _CLUTTER_MAIN_H__ */

View file

@ -326,12 +326,12 @@ master_clock_next_frame_delay (ClutterMasterClock *master_clock)
return 0;
}
next += (1000000L / clutter_get_default_frame_rate ());
next += (1000000L / _clutter_context_get_frame_rate ());
if (next <= now)
{
CLUTTER_NOTE (SCHEDULER, "Less than %lu microsecs",
1000000L / (gulong) clutter_get_default_frame_rate ());
1000000L / (gulong) _clutter_context_get_frame_rate ());
return 0;
}

View file

@ -211,6 +211,7 @@ guint32 _clutter_context_acquire_id (gpointe
void _clutter_context_release_id (guint32 id_);
gboolean _clutter_context_get_motion_events_enabled (void);
gboolean _clutter_context_get_show_fps (void);
guint _clutter_context_get_frame_rate (void);
const gchar *_clutter_gettext (const gchar *str);

View file

@ -131,11 +131,8 @@
#include <glib-object.h>
#include <gmodule.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-actor.h"
#include "clutter-stage.h"
#include "clutter-texture.h"
#include "clutter-script.h"
#include "clutter-script-private.h"

View file

@ -29,7 +29,7 @@
#define __CLUTTER_STAGE_H__
#include <clutter/clutter-types.h>
#include <clutter/clutter-group.h>
#include <clutter/clutter-actor.h>
G_BEGIN_DECLS

View file

@ -1,128 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_TEXTURE_H__
#define __CLUTTER_TEXTURE_H__
#include <cogl/cogl.h>
#include <clutter/clutter-actor.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_TEXTURE (clutter_texture_get_type ())
#define CLUTTER_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TEXTURE, ClutterTexture))
#define CLUTTER_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TEXTURE, ClutterTextureClass))
#define CLUTTER_IS_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TEXTURE))
#define CLUTTER_IS_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TEXTURE))
#define CLUTTER_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TEXTURE, ClutterTextureClass))
/**
* ClutterTextureError:
* @CLUTTER_TEXTURE_ERROR_OUT_OF_MEMORY: OOM condition
* @CLUTTER_TEXTURE_ERROR_NO_YUV: YUV operation attempted but no YUV support
* found
* @CLUTTER_TEXTURE_ERROR_BAD_FORMAT: The requested format for
* clutter_texture_set_from_rgb_data or
* clutter_texture_set_from_yuv_data is unsupported.
*
* Error enumeration for #ClutterTexture
*
*
*/
typedef enum {
CLUTTER_TEXTURE_ERROR_OUT_OF_MEMORY,
CLUTTER_TEXTURE_ERROR_NO_YUV,
CLUTTER_TEXTURE_ERROR_BAD_FORMAT
} ClutterTextureError;
/**
* CLUTTER_TEXTURE_ERROR:
*
* Error domain for #ClutterTexture errors
*
*
*/
#define CLUTTER_TEXTURE_ERROR (clutter_texture_error_quark ())
GQuark clutter_texture_error_quark (void);
typedef struct _ClutterTexture ClutterTexture;
typedef struct _ClutterTextureClass ClutterTextureClass;
typedef struct _ClutterTexturePrivate ClutterTexturePrivate;
/**
* ClutterTexture:
*
* The #ClutterTexture structure contains only private data
* and should be accessed using the provided API
*
*
*/
struct _ClutterTexture
{
/*< private >*/
ClutterActor parent;
ClutterTexturePrivate *priv;
};
/**
* ClutterTextureClass:
* @size_change: handler for the #ClutterTexture::size-change signal
* @pixbuf_change: handler for the #ClutterTexture::pixbuf-change signal
* @load_finished: handler for the #ClutterTexture::load-finished signal
*
* The #ClutterTextureClass structure contains only private data
*
*
*/
struct _ClutterTextureClass
{
/*< private >*/
ClutterActorClass parent_class;
/*< public >*/
void (* size_change) (ClutterTexture *texture,
gint width,
gint height);
void (* pixbuf_change) (ClutterTexture *texture);
void (* load_finished) (ClutterTexture *texture,
const GError *error);
/*< private >*/
/* padding, for future expansion */
void (*_clutter_texture1) (void);
void (*_clutter_texture2) (void);
void (*_clutter_texture3) (void);
void (*_clutter_texture4) (void);
void (*_clutter_texture5) (void);
};
GType clutter_texture_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __CLUTTER_TEXTURE_H__ */

View file

@ -85,11 +85,6 @@ typedef struct _ClutterRect ClutterRect;
typedef struct _ClutterSize ClutterSize;
typedef struct _ClutterVertex ClutterVertex;
typedef struct _ClutterAlpha ClutterAlpha;
typedef struct _ClutterAnimation ClutterAnimation;
typedef struct _ClutterAnimator ClutterAnimator;
typedef struct _ClutterState ClutterState;
typedef struct _ClutterInputDevice ClutterInputDevice;
typedef CoglMatrix ClutterMatrix;
@ -106,10 +101,6 @@ typedef union _ClutterEvent ClutterEvent;
*/
typedef struct _ClutterEventSequence ClutterEventSequence;
typedef struct _ClutterFog ClutterFog; /* deprecated */
typedef struct _ClutterBehaviour ClutterBehaviour; /* deprecated */
typedef struct _ClutterShader ClutterShader; /* deprecated */
/**
* ClutterPaintVolume:
*

View file

@ -67,7 +67,6 @@
#include "clutter-flow-layout.h"
#include "clutter-gesture-action.h"
#include "clutter-grid-layout.h"
#include "clutter-group.h"
#include "clutter-image.h"
#include "clutter-input-device.h"
#include "clutter-interval.h"
@ -100,7 +99,6 @@
#include "clutter-stage-manager.h"
#include "clutter-table-layout.h"
#include "clutter-tap-action.h"
#include "clutter-texture.h"
#include "clutter-text.h"
#include "clutter-timeline.h"
#include "clutter-transition-group.h"

View file

@ -513,7 +513,6 @@ clutter_get_accessibility_enabled
clutter_get_current_event
clutter_get_current_event_time
clutter_get_default_backend
clutter_get_default_frame_rate
clutter_get_default_text_direction
clutter_get_font_map
clutter_get_keyboard_grab
@ -523,7 +522,6 @@ clutter_get_pointer_grab
clutter_get_script_id
clutter_grab_keyboard
clutter_grab_pointer
clutter_gravity_get_type
clutter_grid_child_get_type
clutter_grid_layout_get_type
clutter_grid_layout_new
@ -556,7 +554,6 @@ clutter_init
clutter_init_error_get_type
clutter_init_error_quark
clutter_init_with_args
clutter_interpolation_get_type
clutter_interval_clone
clutter_interval_compute
clutter_interval_compute_value
@ -1185,10 +1182,8 @@ clutter_x11_filter_return_get_type
clutter_x11_get_current_event_time
clutter_x11_get_default_display
clutter_x11_get_default_screen
clutter_x11_get_input_devices
clutter_x11_get_root_window
clutter_x11_get_stage_from_window
clutter_x11_get_stage_visual
clutter_x11_get_stage_window
clutter_x11_get_use_argb_visual
clutter_x11_get_visual_info

View file

@ -1,411 +0,0 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <glib-object.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-actor.h"
#include "clutter-actor-private.h"
#include "clutter-private.h"
#include "clutter-shader.h"
typedef struct _ShaderData ShaderData;
struct _ShaderData
{
ClutterShader *shader;
/* back pointer to the actor */
ClutterActor *actor;
/* list of values that should be set on the shader
* before each paint cycle
*/
GHashTable *value_hash;
};
static void
shader_value_free (gpointer data)
{
GValue *var = data;
g_value_unset (var);
g_slice_free (GValue, var);
}
static void
destroy_shader_data (gpointer data)
{
ShaderData *shader_data = data;
if (shader_data == NULL)
return;
if (shader_data->shader != NULL)
{
g_object_unref (shader_data->shader);
shader_data->shader = NULL;
}
if (shader_data->value_hash != NULL)
{
g_hash_table_destroy (shader_data->value_hash);
shader_data->value_hash = NULL;
}
g_slice_free (ShaderData, shader_data);
}
/**
* clutter_actor_get_shader:
* @self: a #ClutterActor
*
* Queries the currently set #ClutterShader on @self.
*
* Return value: (transfer none): The currently set #ClutterShader
* or %NULL if no shader is set.
*
*
*
* Deprecated: 1.8: Use clutter_actor_get_effect() instead.
*/
ClutterShader *
clutter_actor_get_shader (ClutterActor *self)
{
ShaderData *shader_data;
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
shader_data = g_object_get_data (G_OBJECT (self), "-clutter-actor-shader-data");
if (shader_data != NULL)
return shader_data->shader;
return NULL;
}
/**
* clutter_actor_set_shader:
* @self: a #ClutterActor
* @shader: (allow-none): a #ClutterShader or %NULL to unset the shader.
*
* Sets the #ClutterShader to be used when rendering @self.
*
* If @shader is %NULL this function will unset any currently set shader
* for the actor.
*
* <note>Any #ClutterEffect applied to @self will take the precedence
* over the #ClutterShader set using this function.</note>
*
* Return value: %TRUE if the shader was successfully applied
* or removed
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect and
* clutter_actor_add_effect() instead.
*/
gboolean
clutter_actor_set_shader (ClutterActor *self,
ClutterShader *shader)
{
ShaderData *shader_data;
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
g_return_val_if_fail (shader == NULL || CLUTTER_IS_SHADER (shader), FALSE);
if (shader != NULL)
g_object_ref (shader);
else
{
/* if shader passed in is NULL we destroy the shader */
g_object_set_data (G_OBJECT (self), "-clutter-actor-shader-data", NULL);
return TRUE;
}
shader_data = g_object_get_data (G_OBJECT (self), "-clutter-actor-shader-data");
if (shader_data == NULL)
{
shader_data = g_slice_new (ShaderData);
shader_data->actor = self;
shader_data->shader = NULL;
shader_data->value_hash =
g_hash_table_new_full (g_str_hash, g_str_equal,
g_free,
shader_value_free);
g_object_set_data_full (G_OBJECT (self), "-clutter-actor-shader-data",
shader_data,
destroy_shader_data);
}
if (shader_data->shader != NULL)
g_object_unref (shader_data->shader);
shader_data->shader = shader;
clutter_actor_queue_redraw (self);
return TRUE;
}
static void
set_each_param (gpointer key,
gpointer value,
gpointer user_data)
{
ClutterShader *shader = user_data;
const gchar *uniform = key;
GValue *var = value;
clutter_shader_set_uniform (shader, uniform, var);
}
void
_clutter_actor_shader_pre_paint (ClutterActor *actor,
gboolean repeat)
{
ShaderData *shader_data;
ClutterShader *shader;
shader_data = g_object_get_data (G_OBJECT (actor), "-clutter-actor-shader-data");
if (shader_data == NULL)
return;
shader = shader_data->shader;
if (shader != NULL)
{
clutter_shader_set_is_enabled (shader, TRUE);
g_hash_table_foreach (shader_data->value_hash, set_each_param, shader);
if (!repeat)
_clutter_context_push_shader_stack (actor);
}
}
void
_clutter_actor_shader_post_paint (ClutterActor *actor)
{
ShaderData *shader_data;
ClutterShader *shader;
shader_data = g_object_get_data (G_OBJECT (actor), "-clutter-actor-shader-data");
if (G_LIKELY (shader_data == NULL))
return;
shader = shader_data->shader;
if (shader != NULL)
{
ClutterActor *head;
clutter_shader_set_is_enabled (shader, FALSE);
/* remove the actor from the shaders stack; if there is another
* actor inside it, then call pre-paint again to set its shader
* but this time with the second argument being TRUE, indicating
* that we are re-applying an existing shader and thus should it
* not be prepended to the stack
*/
head = _clutter_context_pop_shader_stack (actor);
if (head != NULL)
_clutter_actor_shader_pre_paint (head, TRUE);
}
}
static inline void
clutter_actor_set_shader_param_internal (ClutterActor *self,
const gchar *param,
const GValue *value)
{
ShaderData *shader_data;
GValue *var;
shader_data = g_object_get_data (G_OBJECT (self), "-clutter-actor-shader-data");
if (shader_data == NULL)
return;
var = g_slice_new0 (GValue);
g_value_init (var, G_VALUE_TYPE (value));
g_value_copy (value, var);
g_hash_table_insert (shader_data->value_hash, g_strdup (param), var);
clutter_actor_queue_redraw (self);
}
/**
* clutter_actor_set_shader_param:
* @self: a #ClutterActor
* @param: the name of the parameter
* @value: the value of the parameter
*
* Sets the value for a named parameter of the shader applied
* to @actor.
*
*
*
* Deprecated: 1.8: Use clutter_shader_effect_set_uniform_value() instead
*/
void
clutter_actor_set_shader_param (ClutterActor *self,
const gchar *param,
const GValue *value)
{
g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_return_if_fail (param != NULL);
g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value) ||
CLUTTER_VALUE_HOLDS_SHADER_INT (value) ||
CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value) ||
G_VALUE_HOLDS_FLOAT (value) ||
G_VALUE_HOLDS_INT (value));
clutter_actor_set_shader_param_internal (self, param, value);
}
/**
* clutter_actor_set_shader_param_float:
* @self: a #ClutterActor
* @param: the name of the parameter
* @value: the value of the parameter
*
* Sets the value for a named float parameter of the shader applied
* to @actor.
*
*
*
* Deprecated: 1.8: Use clutter_shader_effect_set_uniform() instead
*/
void
clutter_actor_set_shader_param_float (ClutterActor *self,
const gchar *param,
gfloat value)
{
GValue var = { 0, };
g_value_init (&var, G_TYPE_FLOAT);
g_value_set_float (&var, value);
clutter_actor_set_shader_param_internal (self, param, &var);
g_value_unset (&var);
}
/**
* clutter_actor_set_shader_param_int:
* @self: a #ClutterActor
* @param: the name of the parameter
* @value: the value of the parameter
*
* Sets the value for a named int parameter of the shader applied to
* @actor.
*
*
*
* Deprecated: 1.8: Use clutter_shader_effect_set_uniform() instead
*/
void
clutter_actor_set_shader_param_int (ClutterActor *self,
const gchar *param,
gint value)
{
GValue var = { 0, };
g_value_init (&var, G_TYPE_INT);
g_value_set_int (&var, value);
clutter_actor_set_shader_param_internal (self, param, &var);
g_value_unset (&var);
}
/**
* clutter_actor_set_geometry:
* @self: A #ClutterActor
* @geometry: A #ClutterGeometry
*
* Sets the actor's fixed position and forces its minimum and natural
* size, in pixels. This means the untransformed actor will have the
* given geometry. This is the same as calling clutter_actor_set_position()
* and clutter_actor_set_size().
*
* Deprecated: 1.10: Use clutter_actor_set_position() and
* clutter_actor_set_size() instead.
*/
void
clutter_actor_set_geometry (ClutterActor *self,
const ClutterGeometry *geometry)
{
g_object_freeze_notify (G_OBJECT (self));
clutter_actor_set_position (self, geometry->x, geometry->y);
clutter_actor_set_size (self, geometry->width, geometry->height);
g_object_thaw_notify (G_OBJECT (self));
}
/**
* clutter_actor_get_geometry:
* @self: A #ClutterActor
* @geometry: (out caller-allocates): A location to store actors #ClutterGeometry
*
* Gets the size and position of an actor relative to its parent
* actor. This is the same as calling clutter_actor_get_position() and
* clutter_actor_get_size(). It tries to "do what you mean" and get the
* requested size and position if the actor's allocation is invalid.
*
* Deprecated: 1.10: Use clutter_actor_get_position() and
* clutter_actor_get_size(), or clutter_actor_get_allocation_geometry()
* instead.
*/
void
clutter_actor_get_geometry (ClutterActor *self,
ClutterGeometry *geometry)
{
gfloat x, y, width, height;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_return_if_fail (geometry != NULL);
clutter_actor_get_position (self, &x, &y);
clutter_actor_get_size (self, &width, &height);
geometry->x = (int) x;
geometry->y = (int) y;
geometry->width = (int) width;
geometry->height = (int) height;
}
/**
* clutter_actor_get_allocation_geometry:
* @self: A #ClutterActor
* @geom: (out): allocation geometry in pixels
*
* Gets the layout box an actor has been assigned. The allocation can
* only be assumed valid inside a paint() method; anywhere else, it
* may be out-of-date.
*
* An allocation does not incorporate the actor's scale or anchor point;
* those transformations do not affect layout, only rendering.
*
* The returned rectangle is in pixels.
*
*
*
* Deprecated: 1.12: Use clutter_actor_get_allocation_box() instead.
*/
void
clutter_actor_get_allocation_geometry (ClutterActor *self,
ClutterGeometry *geom)
{
ClutterActorBox box;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_return_if_fail (geom != NULL);
clutter_actor_get_allocation_box (self, &box);
geom->x = CLUTTER_NEARBYINT (clutter_actor_box_get_x (&box));
geom->y = CLUTTER_NEARBYINT (clutter_actor_box_get_y (&box));
geom->width = CLUTTER_NEARBYINT (clutter_actor_box_get_width (&box));
geom->height = CLUTTER_NEARBYINT (clutter_actor_box_get_height (&box));
}

View file

@ -1,161 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
* Copyright (C) 2009, 2010 Intel Corp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_ACTOR_DEPRECATED_H__
#define __CLUTTER_ACTOR_DEPRECATED_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_IN_1_10
void clutter_actor_set_geometry (ClutterActor *self,
const ClutterGeometry *geometry);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_get_allocation_geometry)
void clutter_actor_get_geometry (ClutterActor *self,
ClutterGeometry *geometry);
CLUTTER_DEPRECATED_IN_1_8
guint32 clutter_actor_get_gid (ClutterActor *self);
CLUTTER_DEPRECATED_IN_1_8
ClutterActor * clutter_get_actor_by_gid (guint32 id_);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_remove_child() and clutter_actor_add_child())
void clutter_actor_reparent (ClutterActor *self,
ClutterActor *new_parent);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_add_child)
void clutter_actor_set_parent (ClutterActor *self,
ClutterActor *parent);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_remove_child)
void clutter_actor_unparent (ClutterActor *self);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_set_child_above_sibling)
void clutter_actor_raise (ClutterActor *self,
ClutterActor *below);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_set_child_below_sibling)
void clutter_actor_lower (ClutterActor *self,
ClutterActor *above);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_set_child_above_sibling() with NULL sibling)
void clutter_actor_raise_top (ClutterActor *self);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_set_child_below_sibling() with NULL sibling)
void clutter_actor_lower_bottom (ClutterActor *self);
CLUTTER_DEPRECATED_IN_1_10
void clutter_actor_push_internal (ClutterActor *self);
CLUTTER_DEPRECATED_IN_1_10
void clutter_actor_pop_internal (ClutterActor *self);
CLUTTER_DEPRECATED_IN_1_10
void clutter_actor_show_all (ClutterActor *self);
CLUTTER_DEPRECATED_IN_1_10
void clutter_actor_hide_all (ClutterActor *self);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_actor_set_z_position)
void clutter_actor_set_depth (ClutterActor *self,
gfloat depth);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_actor_get_z_position)
gfloat clutter_actor_get_depth (ClutterActor *self);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_actor_set_rotation_angle)
void clutter_actor_set_rotation (ClutterActor *self,
ClutterRotateAxis axis,
gdouble angle,
gfloat x,
gfloat y,
gfloat z);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_actor_set_rotation_angle and clutter_actor_set_pivot_point)
void clutter_actor_set_z_rotation_from_gravity (ClutterActor *self,
gdouble angle,
ClutterGravity gravity);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_actor_get_rotation_angle)
gdouble clutter_actor_get_rotation (ClutterActor *self,
ClutterRotateAxis axis,
gfloat *x,
gfloat *y,
gfloat *z);
CLUTTER_DEPRECATED_IN_1_12
ClutterGravity clutter_actor_get_z_rotation_gravity (ClutterActor *self);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_actor_set_scale and clutter_actor_set_pivot_point)
void clutter_actor_set_scale_full (ClutterActor *self,
gdouble scale_x,
gdouble scale_y,
gfloat center_x,
gfloat center_y);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_actor_set_scale and clutter_actor_set_pivot_point)
void clutter_actor_set_scale_with_gravity (ClutterActor *self,
gdouble scale_x,
gdouble scale_y,
ClutterGravity gravity);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_actor_get_pivot_point)
void clutter_actor_get_scale_center (ClutterActor *self,
gfloat *center_x,
gfloat *center_y);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_actor_get_pivot_point)
ClutterGravity clutter_actor_get_scale_gravity (ClutterActor *self);
CLUTTER_DEPRECATED_IN_1_12
void clutter_actor_set_anchor_point (ClutterActor *self,
gfloat anchor_x,
gfloat anchor_y);
CLUTTER_DEPRECATED_IN_1_12
void clutter_actor_move_anchor_point (ClutterActor *self,
gfloat anchor_x,
gfloat anchor_y);
CLUTTER_DEPRECATED_IN_1_12
void clutter_actor_get_anchor_point (ClutterActor *self,
gfloat *anchor_x,
gfloat *anchor_y);
CLUTTER_DEPRECATED_IN_1_12
ClutterGravity clutter_actor_get_anchor_point_gravity (ClutterActor *self);
CLUTTER_DEPRECATED_IN_1_12
void clutter_actor_set_anchor_point_from_gravity (ClutterActor *self,
ClutterGravity gravity);
CLUTTER_DEPRECATED_IN_1_12
void clutter_actor_move_anchor_point_from_gravity (ClutterActor *self,
ClutterGravity gravity);
CLUTTER_DEPRECATED_IN_1_12
void clutter_actor_get_transformation_matrix (ClutterActor *self,
ClutterMatrix *matrix);
CLUTTER_DEPRECATED_IN_1_12_FOR (clutter_actor_get_allocation_box)
void clutter_actor_get_allocation_geometry (ClutterActor *self,
ClutterGeometry *geom);
G_END_DECLS
#endif /* __CLUTTER_ACTOR_DEPRECATED_H__ */

View file

@ -1,959 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
* Tomas Frydrych <tf@openedhand.com>
*
* Copyright (C) 2006, 2007, 2008 OpenedHand
* Copyright (C) 2009, 2010 Intel Corp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-alpha
* @short_description: A class for calculating a value as a function of time
*
* #ClutterAlpha is a class for calculating an floating point value
* dependent only on the position of a #ClutterTimeline.
*
* <warning>For newly written code, it is recommended to use the
* #ClutterTimeline:progress-mode property of #ClutterTimeline, or the
* clutter_timeline_set_progress_func() function instead of #ClutterAlpha.
* The #ClutterAlpha class will be deprecated in the future, and will not
* be available any more in the next major version of Clutter.</warning>
*
* A #ClutterAlpha binds a #ClutterTimeline to a progress function which
* translates the time T into an adimensional factor alpha. The factor can
* then be used to drive a #ClutterBehaviour, which will translate the
* alpha value into something meaningful for a #ClutterActor.
*
* You should provide a #ClutterTimeline and bind it to the #ClutterAlpha
* instance using clutter_alpha_set_timeline(). You should also set an
* "animation mode", either by using the #ClutterAnimationMode values that
* Clutter itself provides or by registering custom functions using
* clutter_alpha_register_func().
*
* Instead of a #ClutterAnimationMode you may provide a function returning
* the alpha value depending on the progress of the timeline, using
* clutter_alpha_set_func() or clutter_alpha_set_closure(). The alpha
* function will be executed each time a new frame in the #ClutterTimeline
* is reached.
*
* Since the alpha function is controlled by the timeline instance, you can
* pause, stop or resume the #ClutterAlpha from calling the alpha function by
* using the appropriate functions of the #ClutterTimeline object.
*
* #ClutterAlpha is used to "drive" a #ClutterBehaviour instance, and it
* is internally used by the #ClutterAnimation API.
*
* <refsect2 id="ClutterAlpha-script">
* <title>ClutterAlpha custom properties for #ClutterScript</title>
* <para>#ClutterAlpha defines a custom "function" property for
* #ClutterScript which allows to reference a custom alpha function
* available in the source code. Setting the "function" property
* is equivalent to calling clutter_alpha_set_func() with the
* specified function name. No user data or #GDestroyNotify is
* available to be passed.</para>
* <example id="ClutterAlpha-script-example">
* <title>Defining a ClutterAlpha in ClutterScript</title>
* <para>The following JSON fragment defines a #ClutterAlpha
* using a #ClutterTimeline with id "sine-timeline" and an alpha
* function called <function>my_sine_alpha</function>. The defined
* #ClutterAlpha instance can be reused in multiple #ClutterBehaviour
* definitions or for #ClutterAnimation definitions.</para>
* <programlisting><![CDATA[
* {
* "id" : "sine-alpha",
* "timeline" : {
* "id" : "sine-timeline",
* "duration" : 500,
* "loop" : true
* },
* "function" : "my_sine_alpha"
* }
* ]]></programlisting>
* </example>
* <para>For the way to define the #ClutterAlpha:mode property
* inside a ClutterScript fragment, see <link
* linkend="clutter-AnimationMode-Script">the corresponding section</link>
* in #ClutterAnimation.</para>
* </refsect2>
*
* #ClutterAlpha is available since Clutter 0.2.
*
* #ClutterAlpha is deprecated since Clutter 1.12; use #ClutterTimeline and the
* #ClutterTimeline:progress-mode property.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <math.h>
#include <gmodule.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-alpha.h"
#include "clutter-debug.h"
#include "clutter-enum-types.h"
#include "clutter-easing.h"
#include "clutter-main.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "clutter-scriptable.h"
#include "clutter-script-private.h"
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
G_DEFINE_TYPE_WITH_CODE (ClutterAlpha,
clutter_alpha,
G_TYPE_INITIALLY_UNOWNED,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
clutter_scriptable_iface_init));
struct _ClutterAlphaPrivate
{
ClutterTimeline *timeline;
guint timeline_new_frame_id;
gdouble alpha;
GClosure *closure;
ClutterAlphaFunc func;
gpointer user_data;
GDestroyNotify notify;
gulong mode;
};
enum
{
PROP_0,
PROP_TIMELINE,
PROP_ALPHA,
PROP_MODE,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
static void
timeline_new_frame_cb (ClutterTimeline *timeline,
guint msecs,
ClutterAlpha *alpha)
{
ClutterAlphaPrivate *priv = alpha->priv;
/* Update alpha value and notify */
priv->alpha = clutter_alpha_get_alpha (alpha);
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_ALPHA]);
}
static void
clutter_alpha_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterAlpha *alpha = CLUTTER_ALPHA (object);
switch (prop_id)
{
case PROP_TIMELINE:
clutter_alpha_set_timeline (alpha, g_value_get_object (value));
break;
case PROP_MODE:
clutter_alpha_set_mode (alpha, g_value_get_ulong (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_alpha_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterAlphaPrivate *priv = CLUTTER_ALPHA (object)->priv;
switch (prop_id)
{
case PROP_TIMELINE:
g_value_set_object (value, priv->timeline);
break;
case PROP_ALPHA:
g_value_set_double (value, priv->alpha);
break;
case PROP_MODE:
g_value_set_ulong (value, priv->mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_alpha_finalize (GObject *object)
{
ClutterAlphaPrivate *priv = CLUTTER_ALPHA (object)->priv;
if (priv->notify != NULL)
priv->notify (priv->user_data);
else if (priv->closure != NULL)
g_closure_unref (priv->closure);
G_OBJECT_CLASS (clutter_alpha_parent_class)->finalize (object);
}
static void
clutter_alpha_dispose (GObject *object)
{
ClutterAlpha *self = CLUTTER_ALPHA(object);
clutter_alpha_set_timeline (self, NULL);
G_OBJECT_CLASS (clutter_alpha_parent_class)->dispose (object);
}
static ClutterAlphaFunc
resolve_alpha_func (const gchar *name)
{
static GModule *module = NULL;
ClutterAlphaFunc func;
CLUTTER_NOTE (SCRIPT, "Looking up '%s' alpha function", name);
if (G_UNLIKELY (module == NULL))
module = g_module_open (NULL, 0);
if (g_module_symbol (module, name, (gpointer) &func))
{
CLUTTER_NOTE (SCRIPT, "Found '%s' alpha function in the symbols table",
name);
return func;
}
return NULL;
}
static void
clutter_alpha_set_custom_property (ClutterScriptable *scriptable,
ClutterScript *script,
const gchar *name,
const GValue *value)
{
if (strncmp (name, "function", 8) == 0)
{
g_assert (G_VALUE_HOLDS (value, G_TYPE_POINTER));
if (g_value_get_pointer (value) != NULL)
{
clutter_alpha_set_func (CLUTTER_ALPHA (scriptable),
g_value_get_pointer (value),
NULL, NULL);
}
}
else
g_object_set_property (G_OBJECT (scriptable), name, value);
}
static gboolean
clutter_alpha_parse_custom_node (ClutterScriptable *scriptable,
ClutterScript *script,
GValue *value,
const gchar *name,
JsonNode *node)
{
if (strncmp (name, "function", 8) == 0)
{
const gchar *func_name = json_node_get_string (node);
g_value_init (value, G_TYPE_POINTER);
g_value_set_pointer (value, resolve_alpha_func (func_name));
return TRUE;
}
/* we need to do this because we use gulong in place
* of ClutterAnimationMode for ClutterAlpha:mode
*/
if (strncmp (name, "mode", 4) == 0)
{
gulong mode;
mode = _clutter_script_resolve_animation_mode (node);
g_value_init (value, G_TYPE_ULONG);
g_value_set_ulong (value, mode);
return TRUE;
}
return FALSE;
}
static void
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
{
iface->parse_custom_node = clutter_alpha_parse_custom_node;
iface->set_custom_property = clutter_alpha_set_custom_property;
}
static void
clutter_alpha_class_init (ClutterAlphaClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = clutter_alpha_set_property;
object_class->get_property = clutter_alpha_get_property;
object_class->finalize = clutter_alpha_finalize;
object_class->dispose = clutter_alpha_dispose;
g_type_class_add_private (klass, sizeof (ClutterAlphaPrivate));
/**
* ClutterAlpha:timeline:
*
* A #ClutterTimeline instance used to drive the alpha function.
*
*
*
* Deprecated: 1.12
*/
obj_props[PROP_TIMELINE] =
g_param_spec_object ("timeline",
P_("Timeline"),
P_("Timeline used by the alpha"),
CLUTTER_TYPE_TIMELINE,
CLUTTER_PARAM_READWRITE);
/**
* ClutterAlpha:alpha:
*
* The alpha value as computed by the alpha function. The linear
* interval is 0.0 to 1.0, but the Alpha allows overshooting by
* one unit in each direction, so the valid interval is -1.0 to 2.0.
*
*
* Deprecated: 1.12
*/
obj_props[PROP_ALPHA] =
g_param_spec_double ("alpha",
P_("Alpha value"),
P_("Alpha value as computed by the alpha"),
-1.0, 2.0,
0.0,
CLUTTER_PARAM_READABLE);
/**
* ClutterAlpha:mode:
*
* The progress function logical id - either a value from the
* #ClutterAnimationMode enumeration or a value returned by
* clutter_alpha_register_func().
*
* If %CLUTTER_CUSTOM_MODE is used then the function set using
* clutter_alpha_set_closure() or clutter_alpha_set_func()
* will be used.
*
*
* Deprecated: 1.12
*/
obj_props[PROP_MODE] =
g_param_spec_ulong ("mode",
P_("Mode"),
P_("Progress mode"),
0, G_MAXULONG,
CLUTTER_CUSTOM_MODE,
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE);
g_object_class_install_properties (object_class,
PROP_LAST,
obj_props);
}
static void
clutter_alpha_init (ClutterAlpha *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
CLUTTER_TYPE_ALPHA,
ClutterAlphaPrivate);
self->priv->mode = CLUTTER_CUSTOM_MODE;
self->priv->alpha = 0.0;
}
/**
* clutter_alpha_get_alpha:
* @alpha: A #ClutterAlpha
*
* Query the current alpha value.
*
* Return Value: The current alpha value for the alpha
*
*
*
* Deprecated: 1.12
*/
gdouble
clutter_alpha_get_alpha (ClutterAlpha *alpha)
{
ClutterAlphaPrivate *priv;
gdouble retval = 0;
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), 0);
priv = alpha->priv;
if (G_LIKELY (priv->func))
{
return priv->func (alpha, priv->user_data);
}
else if (priv->closure)
{
GValue params = G_VALUE_INIT;
GValue result_value = G_VALUE_INIT;
g_object_ref (alpha);
g_value_init (&result_value, G_TYPE_DOUBLE);
g_value_init (&params, CLUTTER_TYPE_ALPHA);
g_value_set_object (&params, alpha);
g_closure_invoke (priv->closure, &result_value, 1, &params, NULL);
retval = g_value_get_double (&result_value);
g_value_unset (&result_value);
g_value_unset (&params);
g_object_unref (alpha);
}
return retval;
}
/*
* clutter_alpha_set_closure_internal:
* @alpha: a #ClutterAlpha
* @closure: a #GClosure
*
* Sets the @closure for @alpha. This function does not
* set the #ClutterAlpha:mode property and does not emit
* the #GObject::notify signal for it.
*/
static inline void
clutter_alpha_set_closure_internal (ClutterAlpha *alpha,
GClosure *closure)
{
ClutterAlphaPrivate *priv = alpha->priv;
if (priv->notify != NULL)
priv->notify (priv->user_data);
else if (priv->closure != NULL)
g_closure_unref (priv->closure);
priv->func = NULL;
priv->user_data = NULL;
priv->notify = NULL;
if (closure == NULL)
return;
/* need to take ownership of the closure before sinking it */
priv->closure = g_closure_ref (closure);
g_closure_sink (closure);
/* set the marshaller */
if (G_CLOSURE_NEEDS_MARSHAL (closure))
{
GClosureMarshal marshal = _clutter_marshal_DOUBLE__VOID;
g_closure_set_marshal (priv->closure, marshal);
}
}
/**
* clutter_alpha_set_closure:
* @alpha: A #ClutterAlpha
* @closure: A #GClosure
*
* Sets the #GClosure used to compute the alpha value at each
* frame of the #ClutterTimeline bound to @alpha.
*
*
*
* Deprecated: 1.12
*/
void
clutter_alpha_set_closure (ClutterAlpha *alpha,
GClosure *closure)
{
ClutterAlphaPrivate *priv;
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
g_return_if_fail (closure != NULL);
priv = alpha->priv;
clutter_alpha_set_closure_internal (alpha, closure);
priv->mode = CLUTTER_CUSTOM_MODE;
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]);
}
/**
* clutter_alpha_set_func:
* @alpha: A #ClutterAlpha
* @func: A #ClutterAlphaFunc
* @data: user data to be passed to the alpha function, or %NULL
* @destroy: notify function used when disposing the alpha function
*
* Sets the #ClutterAlphaFunc function used to compute
* the alpha value at each frame of the #ClutterTimeline
* bound to @alpha.
*
* This function will not register @func as a global alpha function.
*
*
*
* Deprecated: 1.12
*/
void
clutter_alpha_set_func (ClutterAlpha *alpha,
ClutterAlphaFunc func,
gpointer data,
GDestroyNotify destroy)
{
ClutterAlphaPrivate *priv;
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
g_return_if_fail (func != NULL);
priv = alpha->priv;
if (priv->notify != NULL)
{
priv->notify (priv->user_data);
}
else if (priv->closure != NULL)
{
g_closure_unref (priv->closure);
priv->closure = NULL;
}
priv->func = func;
priv->user_data = data;
priv->notify = destroy;
priv->mode = CLUTTER_CUSTOM_MODE;
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]);
}
/**
* clutter_alpha_set_timeline:
* @alpha: A #ClutterAlpha
* @timeline: A #ClutterTimeline
*
* Binds @alpha to @timeline.
*
*
*
* Deprecated: 1.12
*/
void
clutter_alpha_set_timeline (ClutterAlpha *alpha,
ClutterTimeline *timeline)
{
ClutterAlphaPrivate *priv;
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
g_return_if_fail (timeline == NULL || CLUTTER_IS_TIMELINE (timeline));
priv = alpha->priv;
if (priv->timeline == timeline)
return;
if (priv->timeline)
{
g_signal_handlers_disconnect_by_func (priv->timeline,
timeline_new_frame_cb,
alpha);
g_object_unref (priv->timeline);
priv->timeline = NULL;
}
if (timeline)
{
priv->timeline = g_object_ref (timeline);
g_signal_connect (priv->timeline, "new-frame",
G_CALLBACK (timeline_new_frame_cb),
alpha);
}
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_TIMELINE]);
}
/**
* clutter_alpha_get_timeline:
* @alpha: A #ClutterAlpha
*
* Gets the #ClutterTimeline bound to @alpha.
*
* Return value: (transfer none): a #ClutterTimeline instance
*
*
*
* Deprecated: 1.12
*/
ClutterTimeline *
clutter_alpha_get_timeline (ClutterAlpha *alpha)
{
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), NULL);
return alpha->priv->timeline;
}
/**
* clutter_alpha_new:
*
* Creates a new #ClutterAlpha instance. You must set a function
* to compute the alpha value using clutter_alpha_set_func() and
* bind a #ClutterTimeline object to the #ClutterAlpha instance
* using clutter_alpha_set_timeline().
*
* You should use the newly created #ClutterAlpha instance inside
* a #ClutterBehaviour object.
*
* Return value: the newly created empty #ClutterAlpha instance.
*
*
*
* Deprecated: 1.12
*/
ClutterAlpha *
clutter_alpha_new (void)
{
return g_object_new (CLUTTER_TYPE_ALPHA, NULL);
}
/**
* clutter_alpha_new_full:
* @timeline: #ClutterTimeline timeline
* @mode: animation mode
*
* Creates a new #ClutterAlpha instance and sets the timeline
* and animation mode.
*
* See also clutter_alpha_set_timeline() and clutter_alpha_set_mode().
*
* Return Value: the newly created #ClutterAlpha
*
*
*
* Deprecated: 1.12
*/
ClutterAlpha *
clutter_alpha_new_full (ClutterTimeline *timeline,
gulong mode)
{
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
g_return_val_if_fail (mode != CLUTTER_ANIMATION_LAST, NULL);
return g_object_new (CLUTTER_TYPE_ALPHA,
"timeline", timeline,
"mode", mode,
NULL);
}
/**
* clutter_alpha_new_with_func:
* @timeline: a #ClutterTimeline
* @func: a #ClutterAlphaFunc
* @data: data to pass to the function, or %NULL
* @destroy: function to call when removing the alpha function, or %NULL
*
* Creates a new #ClutterAlpha instances and sets the timeline
* and the alpha function.
*
* This function will not register @func as a global alpha function.
*
* See also clutter_alpha_set_timeline() and clutter_alpha_set_func().
*
* Return value: the newly created #ClutterAlpha
*
*
*
* Deprecated: 1.12
*/
ClutterAlpha *
clutter_alpha_new_with_func (ClutterTimeline *timeline,
ClutterAlphaFunc func,
gpointer data,
GDestroyNotify destroy)
{
ClutterAlpha *retval;
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
g_return_val_if_fail (func != NULL, NULL);
retval = clutter_alpha_new ();
clutter_alpha_set_timeline (retval, timeline);
clutter_alpha_set_func (retval, func, data, destroy);
return retval;
}
/**
* clutter_alpha_get_mode:
* @alpha: a #ClutterAlpha
*
* Retrieves the #ClutterAnimationMode used by @alpha.
*
* Return value: the animation mode
*
*
*
* Deprecated: 1.12
*/
gulong
clutter_alpha_get_mode (ClutterAlpha *alpha)
{
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), CLUTTER_CUSTOM_MODE);
return alpha->priv->mode;
}
typedef struct _AlphaData {
guint closure_set : 1;
ClutterAlphaFunc func;
gpointer data;
GClosure *closure;
} AlphaData;
static GPtrArray *clutter_alphas = NULL;
static gdouble
clutter_alpha_easing_func (ClutterAlpha *alpha,
gpointer data G_GNUC_UNUSED)
{
ClutterAlphaPrivate *priv = alpha->priv;
ClutterTimeline *timeline = priv->timeline;
gdouble t, d;
if (G_UNLIKELY (priv->timeline == NULL))
return 0.0;
t = clutter_timeline_get_elapsed_time (timeline);
d = clutter_timeline_get_duration (timeline);
return clutter_easing_for_mode (priv->mode, t, d);
}
/**
* clutter_alpha_set_mode:
* @alpha: a #ClutterAlpha
* @mode: a #ClutterAnimationMode
*
* Sets the progress function of @alpha using the symbolic value
* of @mode, as taken by the #ClutterAnimationMode enumeration or
* using the value returned by clutter_alpha_register_func().
*
*
*
* Deprecated: 1.12
*/
void
clutter_alpha_set_mode (ClutterAlpha *alpha,
gulong mode)
{
ClutterAlphaPrivate *priv;
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
g_return_if_fail (mode != CLUTTER_ANIMATION_LAST);
priv = alpha->priv;
if (mode == CLUTTER_CUSTOM_MODE)
{
priv->mode = mode;
}
else if (mode < CLUTTER_ANIMATION_LAST)
{
if (priv->mode == mode)
return;
/* sanity check to avoid getting an out of sync
* enum/function mapping
*/
g_assert (clutter_get_easing_func_for_mode (mode) != NULL);
clutter_alpha_set_closure_internal (alpha, NULL);
priv->mode = mode;
CLUTTER_NOTE (ANIMATION, "New easing mode '%s'[%lu]\n",
clutter_get_easing_name_for_mode (priv->mode),
priv->mode);
priv->func = clutter_alpha_easing_func;
priv->user_data = NULL;
priv->notify = NULL;
}
else if (mode > CLUTTER_ANIMATION_LAST)
{
AlphaData *alpha_data = NULL;
gulong real_index = 0;
if (priv->mode == mode)
return;
if (G_UNLIKELY (clutter_alphas == NULL))
{
g_warning ("No alpha functions defined for ClutterAlpha to use. "
"Use clutter_alpha_register_func() to register an "
"alpha function.");
return;
}
real_index = mode - CLUTTER_ANIMATION_LAST - 1;
alpha_data = g_ptr_array_index (clutter_alphas, real_index);
if (G_UNLIKELY (alpha_data == NULL))
{
g_warning ("No alpha function registered for mode %lu.",
mode);
return;
}
if (alpha_data->closure_set)
clutter_alpha_set_closure (alpha, alpha_data->closure);
else
{
clutter_alpha_set_closure_internal (alpha, NULL);
priv->func = alpha_data->func;
priv->user_data = alpha_data->data;
priv->notify = NULL;
}
priv->mode = mode;
}
else
g_assert_not_reached ();
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]);
}
static gulong
register_alpha_internal (AlphaData *alpha_data)
{
if (G_UNLIKELY (clutter_alphas == NULL))
clutter_alphas = g_ptr_array_new ();
g_ptr_array_add (clutter_alphas, alpha_data);
return clutter_alphas->len + CLUTTER_ANIMATION_LAST;
}
/**
* clutter_alpha_register_func: (skip)
* @func: a #ClutterAlphaFunc
* @data: user data to pass to @func, or %NULL
*
* Registers a global alpha function and returns its logical id
* to be used by clutter_alpha_set_mode() or by #ClutterAnimation.
*
* The logical id is always greater than %CLUTTER_ANIMATION_LAST.
*
* Return value: the logical id of the alpha function
*
*
*
* Deprecated: 1.12
*/
gulong
clutter_alpha_register_func (ClutterAlphaFunc func,
gpointer data)
{
AlphaData *alpha_data;
g_return_val_if_fail (func != NULL, 0);
alpha_data = g_slice_new (AlphaData);
alpha_data->closure_set = FALSE;
alpha_data->func = func;
alpha_data->data = data;
return register_alpha_internal (alpha_data);
}
/**
* clutter_alpha_register_closure:
* @closure: a #GClosure
*
* #GClosure variant of clutter_alpha_register_func().
*
* Registers a global alpha function and returns its logical id
* to be used by clutter_alpha_set_mode() or by #ClutterAnimation.
*
* The logical id is always greater than %CLUTTER_ANIMATION_LAST.
*
* Rename to: clutter_alpha_register_func
*
* Return value: the logical id of the alpha function
*
*
*
* Deprecated: 1.12
*/
gulong
clutter_alpha_register_closure (GClosure *closure)
{
AlphaData *alpha_data;
g_return_val_if_fail (closure != NULL, 0);
alpha_data = g_slice_new (AlphaData);
alpha_data->closure_set = TRUE;
alpha_data->closure = closure;
return register_alpha_internal (alpha_data);
}

View file

@ -1,144 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
* Tomas Frydrych <tf@openedhand.com>
*
* Copyright (C) 2006, 2007, 2008 OpenedHand
* Copyright (C) 2009 Intel Corp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_ALPHA_H__
#define __CLUTTER_ALPHA_H__
#include <clutter/clutter-timeline.h>
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_ALPHA (clutter_alpha_get_type ())
#define CLUTTER_ALPHA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ALPHA, ClutterAlpha))
#define CLUTTER_ALPHA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ALPHA, ClutterAlphaClass))
#define CLUTTER_IS_ALPHA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ALPHA))
#define CLUTTER_IS_ALPHA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ALPHA))
#define CLUTTER_ALPHA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ALPHA, ClutterAlphaClass))
typedef struct _ClutterAlphaClass ClutterAlphaClass;
typedef struct _ClutterAlphaPrivate ClutterAlphaPrivate;
/**
* ClutterAlphaFunc:
* @alpha: a #ClutterAlpha
* @user_data: user data passed to the function
*
* A function returning a value depending on the position of
* the #ClutterTimeline bound to @alpha.
*
* Return value: a floating point value
*
*
*/
typedef gdouble (*ClutterAlphaFunc) (ClutterAlpha *alpha,
gpointer user_data);
/**
* ClutterAlpha:
*
* #ClutterAlpha combines a #ClutterTimeline and a function.
* The contents of the #ClutterAlpha structure are private and should
* only be accessed using the provided API.
*
*
*/
struct _ClutterAlpha
{
/*< private >*/
GInitiallyUnowned parent;
ClutterAlphaPrivate *priv;
};
/**
* ClutterAlphaClass:
*
* Base class for #ClutterAlpha
*
*
*/
struct _ClutterAlphaClass
{
/*< private >*/
GInitiallyUnownedClass parent_class;
void (*_clutter_alpha_1) (void);
void (*_clutter_alpha_2) (void);
void (*_clutter_alpha_3) (void);
void (*_clutter_alpha_4) (void);
void (*_clutter_alpha_5) (void);
};
CLUTTER_DEPRECATED_IN_1_12
GType clutter_alpha_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_12
ClutterAlpha * clutter_alpha_new (void);
CLUTTER_DEPRECATED_IN_1_12
ClutterAlpha * clutter_alpha_new_full (ClutterTimeline *timeline,
gulong mode);
CLUTTER_DEPRECATED_IN_1_12
ClutterAlpha * clutter_alpha_new_with_func (ClutterTimeline *timeline,
ClutterAlphaFunc func,
gpointer data,
GDestroyNotify destroy);
CLUTTER_DEPRECATED_IN_1_12
gdouble clutter_alpha_get_alpha (ClutterAlpha *alpha);
CLUTTER_DEPRECATED_IN_1_12
void clutter_alpha_set_func (ClutterAlpha *alpha,
ClutterAlphaFunc func,
gpointer data,
GDestroyNotify destroy);
CLUTTER_DEPRECATED_IN_1_12
void clutter_alpha_set_closure (ClutterAlpha *alpha,
GClosure *closure);
CLUTTER_DEPRECATED_IN_1_12
void clutter_alpha_set_timeline (ClutterAlpha *alpha,
ClutterTimeline *timeline);
CLUTTER_DEPRECATED_IN_1_12
ClutterTimeline *clutter_alpha_get_timeline (ClutterAlpha *alpha);
CLUTTER_DEPRECATED_IN_1_12
void clutter_alpha_set_mode (ClutterAlpha *alpha,
gulong mode);
CLUTTER_DEPRECATED_IN_1_12
gulong clutter_alpha_get_mode (ClutterAlpha *alpha);
CLUTTER_DEPRECATED_IN_1_12
gulong clutter_alpha_register_func (ClutterAlphaFunc func,
gpointer data);
CLUTTER_DEPRECATED_IN_1_12
gulong clutter_alpha_register_closure (GClosure *closure);
G_END_DECLS
#endif /* __CLUTTER_ALPHA_H__ */

View file

@ -1,47 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
*/
#ifndef __CLUTTER_ANIMATABLE_DEPRECATED_H__
#define __CLUTTER_ANIMATABLE_DEPRECATED_H__
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <clutter/clutter-animatable.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_IN_1_8_FOR(clutter_animatable_interpolate_value)
gboolean clutter_animatable_animate_property (ClutterAnimatable *animatable,
ClutterAnimation *animation,
const gchar *property_name,
const GValue *initial_value,
const GValue *final_value,
gdouble progress,
GValue *value);
G_END_DECLS
#endif /* __CLUTTER_ANIMATABLE_DEPRECATED_H__ */

File diff suppressed because it is too large Load diff

View file

@ -1,206 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2008 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_ANIMATION_H__
#define __CLUTTER_ANIMATION_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_ANIMATION (clutter_animation_get_type ())
#define CLUTTER_ANIMATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ANIMATION, ClutterAnimation))
#define CLUTTER_IS_ANIMATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ANIMATION))
#define CLUTTER_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ANIMATION, ClutterAnimationClass))
#define CLUTTER_IS_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ANIMATION))
#define CLUTTER_ANIMATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ANIMATION, ClutterAnimationClass))
typedef struct _ClutterAnimationPrivate ClutterAnimationPrivate;
typedef struct _ClutterAnimationClass ClutterAnimationClass;
/**
* ClutterAnimation:
*
* The #ClutterAnimation structure contains only private data and should
* be accessed using the provided functions.
*
*
*/
struct _ClutterAnimation
{
/*< private >*/
GObject parent_instance;
ClutterAnimationPrivate *priv;
};
/**
* ClutterAnimationClass:
* @started: class handler for the #ClutterAnimation::started signal
* @completed: class handler for the #ClutterAnimation::completed signal
*
* The #ClutterAnimationClass structure contains only private data and
* should be accessed using the provided functions.
*
*
*/
struct _ClutterAnimationClass
{
/*< private >*/
GObjectClass parent_class;
/*< public >*/
void (* started) (ClutterAnimation *animation);
void (* completed) (ClutterAnimation *animation);
/*< private >*/
/* padding for future expansion */
void (*_clutter_reserved1) (void);
void (*_clutter_reserved2) (void);
void (*_clutter_reserved3) (void);
void (*_clutter_reserved4) (void);
void (*_clutter_reserved5) (void);
void (*_clutter_reserved6) (void);
void (*_clutter_reserved7) (void);
void (*_clutter_reserved8) (void);
};
CLUTTER_DEPRECATED_IN_1_12
GType clutter_animation_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_property_transition_new)
ClutterAnimation * clutter_animation_new (void);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_transition_set_animatable)
void clutter_animation_set_object (ClutterAnimation *animation,
GObject *object);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_transition_get_animatable)
GObject * clutter_animation_get_object (ClutterAnimation *animation);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_timeline_set_progress_mode)
void clutter_animation_set_mode (ClutterAnimation *animation,
gulong mode);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_timeline_get_progress_mode)
gulong clutter_animation_get_mode (ClutterAnimation *animation);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_timeline_set_duration)
void clutter_animation_set_duration (ClutterAnimation *animation,
guint msecs);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_timeline_get_duration)
guint clutter_animation_get_duration (ClutterAnimation *animation);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_timeline_set_repeat_count)
void clutter_animation_set_loop (ClutterAnimation *animation,
gboolean loop);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_timeline_get_repeat_count)
gboolean clutter_animation_get_loop (ClutterAnimation *animation);
CLUTTER_DEPRECATED_IN_1_12
void clutter_animation_set_timeline (ClutterAnimation *animation,
ClutterTimeline *timeline);
CLUTTER_DEPRECATED_IN_1_12
ClutterTimeline * clutter_animation_get_timeline (ClutterAnimation *animation);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_animation_set_timeline)
void clutter_animation_set_alpha (ClutterAnimation *animation,
ClutterAlpha *alpha);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_animation_get_timeline)
ClutterAlpha * clutter_animation_get_alpha (ClutterAnimation *animation);
CLUTTER_DEPRECATED_IN_1_12
ClutterAnimation * clutter_animation_bind (ClutterAnimation *animation,
const gchar *property_name,
const GValue *final);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_transition_set_interval)
ClutterAnimation * clutter_animation_bind_interval (ClutterAnimation *animation,
const gchar *property_name,
ClutterInterval *interval);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_animation_has_property (ClutterAnimation *animation,
const gchar *property_name);
CLUTTER_DEPRECATED_IN_1_12
ClutterAnimation * clutter_animation_update (ClutterAnimation *animation,
const gchar *property_name,
const GValue *final);
CLUTTER_DEPRECATED_IN_1_12
void clutter_animation_update_interval (ClutterAnimation *animation,
const gchar *property_name,
ClutterInterval *interval);
CLUTTER_DEPRECATED_IN_1_12
void clutter_animation_unbind_property (ClutterAnimation *animation,
const gchar *property_name);
CLUTTER_DEPRECATED_IN_1_12
ClutterInterval * clutter_animation_get_interval (ClutterAnimation *animation,
const gchar *property_name);
CLUTTER_DEPRECATED_IN_1_12
void clutter_animation_completed (ClutterAnimation *animation);
/*
* ClutterActor API
*/
CLUTTER_DEPRECATED_IN_1_12
ClutterAnimation * clutter_actor_animate (ClutterActor *actor,
gulong mode,
guint duration,
const gchar *first_property_name,
...) G_GNUC_NULL_TERMINATED;
CLUTTER_DEPRECATED_IN_1_12
ClutterAnimation * clutter_actor_animate_with_timeline (ClutterActor *actor,
gulong mode,
ClutterTimeline *timeline,
const gchar *first_property_name,
...) G_GNUC_NULL_TERMINATED;
CLUTTER_DEPRECATED_IN_1_12
ClutterAnimation * clutter_actor_animatev (ClutterActor *actor,
gulong mode,
guint duration,
gint n_properties,
const gchar * const properties[],
const GValue *values);
CLUTTER_DEPRECATED_IN_1_12
ClutterAnimation * clutter_actor_animate_with_timelinev (ClutterActor *actor,
gulong mode,
ClutterTimeline *timeline,
gint n_properties,
const gchar * const properties[],
const GValue *values);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_animate_with_timeline)
ClutterAnimation * clutter_actor_animate_with_alpha (ClutterActor *actor,
ClutterAlpha *alpha,
const gchar *first_property_name,
...) G_GNUC_NULL_TERMINATED;
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_animate_with_timelinev)
ClutterAnimation * clutter_actor_animate_with_alphav (ClutterActor *actor,
ClutterAlpha *alpha,
gint n_properties,
const gchar * const properties[],
const GValue *values);
CLUTTER_DEPRECATED_IN_1_12
ClutterAnimation * clutter_actor_get_animation (ClutterActor *actor);
CLUTTER_DEPRECATED_IN_1_12
void clutter_actor_detach_animation (ClutterActor *actor);
G_END_DECLS
#endif /* __CLUTTER_ANIMATION_DEPRECATED_H__ */

File diff suppressed because it is too large Load diff

View file

@ -1,186 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2010 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Øyvind Kolås <pippin@linux.intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_ANIMATOR_H__
#define __CLUTTER_ANIMATOR_H__
#include <clutter/clutter-types.h>
#include <clutter/clutter-timeline.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_ANIMATOR (clutter_animator_get_type ())
#define CLUTTER_TYPE_ANIMATOR_KEY (clutter_animator_key_get_type ())
#define CLUTTER_ANIMATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ANIMATOR, ClutterAnimator))
#define CLUTTER_ANIMATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ANIMATOR, ClutterAnimatorClass))
#define CLUTTER_IS_ANIMATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ANIMATOR))
#define CLUTTER_IS_ANIMATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ANIMATOR))
#define CLUTTER_ANIMATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ANIMATOR, ClutterAnimatorClass))
/* ClutterAnimator is typedef in clutter-types.h */
typedef struct _ClutterAnimatorClass ClutterAnimatorClass;
typedef struct _ClutterAnimatorPrivate ClutterAnimatorPrivate;
/**
* ClutterAnimatorKey:
*
* A key frame inside a #ClutterAnimator
*
*
*/
typedef struct _ClutterAnimatorKey ClutterAnimatorKey;
/**
* ClutterAnimator:
*
* The #ClutterAnimator structure contains only private data and
* should be accessed using the provided API
*
*
*
* Deprecated: 1.12
*/
struct _ClutterAnimator
{
/*< private >*/
GObject parent_instance;
ClutterAnimatorPrivate *priv;
};
/**
* ClutterAnimatorClass:
*
* The #ClutterAnimatorClass structure contains only private data
*
*
*
* Deprecated: 1.12
*/
struct _ClutterAnimatorClass
{
/*< private >*/
GObjectClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[16];
};
CLUTTER_DEPRECATED_IN_1_12
GType clutter_animator_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_12
ClutterAnimator * clutter_animator_new (void);
CLUTTER_DEPRECATED_IN_1_12
ClutterAnimator * clutter_animator_set_key (ClutterAnimator *animator,
GObject *object,
const gchar *property_name,
guint mode,
gdouble progress,
const GValue *value);
CLUTTER_DEPRECATED_IN_1_12
void clutter_animator_set (ClutterAnimator *animator,
gpointer first_object,
const gchar *first_property_name,
guint first_mode,
gdouble first_progress,
...) G_GNUC_NULL_TERMINATED;
CLUTTER_DEPRECATED_IN_1_12
GList * clutter_animator_get_keys (ClutterAnimator *animator,
GObject *object,
const gchar *property_name,
gdouble progress);
CLUTTER_DEPRECATED_IN_1_12
void clutter_animator_remove_key (ClutterAnimator *animator,
GObject *object,
const gchar *property_name,
gdouble progress);
CLUTTER_DEPRECATED_IN_1_12
ClutterTimeline * clutter_animator_start (ClutterAnimator *animator);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_animator_compute_value (ClutterAnimator *animator,
GObject *object,
const gchar *property_name,
gdouble progress,
GValue *value);
CLUTTER_DEPRECATED_IN_1_12
ClutterTimeline * clutter_animator_get_timeline (ClutterAnimator *animator);
CLUTTER_DEPRECATED_IN_1_12
void clutter_animator_set_timeline (ClutterAnimator *animator,
ClutterTimeline *timeline);
CLUTTER_DEPRECATED_IN_1_12
guint clutter_animator_get_duration (ClutterAnimator *animator);
CLUTTER_DEPRECATED_IN_1_12
void clutter_animator_set_duration (ClutterAnimator *animator,
guint duration);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_animator_property_get_ease_in (ClutterAnimator *animator,
GObject *object,
const gchar *property_name);
CLUTTER_DEPRECATED_IN_1_12
void clutter_animator_property_set_ease_in (ClutterAnimator *animator,
GObject *object,
const gchar *property_name,
gboolean ease_in);
CLUTTER_DEPRECATED_IN_1_12
ClutterInterpolation clutter_animator_property_get_interpolation (ClutterAnimator *animator,
GObject *object,
const gchar *property_name);
CLUTTER_DEPRECATED_IN_1_12
void clutter_animator_property_set_interpolation (ClutterAnimator *animator,
GObject *object,
const gchar *property_name,
ClutterInterpolation interpolation);
CLUTTER_DEPRECATED_IN_1_12
GType clutter_animator_key_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_12
GObject * clutter_animator_key_get_object (const ClutterAnimatorKey *key);
CLUTTER_DEPRECATED_IN_1_12
const gchar * clutter_animator_key_get_property_name (const ClutterAnimatorKey *key);
CLUTTER_DEPRECATED_IN_1_12
GType clutter_animator_key_get_property_type (const ClutterAnimatorKey *key);
CLUTTER_DEPRECATED_IN_1_12
gulong clutter_animator_key_get_mode (const ClutterAnimatorKey *key);
CLUTTER_DEPRECATED_IN_1_12
gdouble clutter_animator_key_get_progress (const ClutterAnimatorKey *key);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_animator_key_get_value (const ClutterAnimatorKey *key,
GValue *value);
G_END_DECLS
#endif /* __CLUTTER_ANIMATOR_H__ */

View file

@ -1,64 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
* Copyright (C) 2009, 2010 Intel Corp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BACKEND_DEPRECATED_H__
#define __CLUTTER_BACKEND_DEPRECATED_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_IN_1_4_FOR(ClutterSettings:font_dpi)
void clutter_backend_set_resolution (ClutterBackend *backend,
gdouble dpi);
CLUTTER_DEPRECATED_IN_1_4_FOR(ClutterSettings:double_click_time)
void clutter_backend_set_double_click_time (ClutterBackend *backend,
guint msec);
CLUTTER_DEPRECATED_IN_1_4_FOR(ClutterSettings:double_click_time)
guint clutter_backend_get_double_click_time (ClutterBackend *backend);
CLUTTER_DEPRECATED_IN_1_4_FOR(ClutterSettings:double_click_distance)
void clutter_backend_set_double_click_distance (ClutterBackend *backend,
guint distance);
CLUTTER_DEPRECATED_IN_1_4_FOR(ClutterSettings:double_click_distance)
guint clutter_backend_get_double_click_distance (ClutterBackend *backend);
CLUTTER_DEPRECATED_IN_1_4_FOR(ClutterSettings:font_name)
void clutter_backend_set_font_name (ClutterBackend *backend,
const gchar *font_name);
CLUTTER_DEPRECATED_IN_1_4_FOR(ClutterSettings:font_name)
const gchar * clutter_backend_get_font_name (ClutterBackend *backend);
G_END_DECLS
#endif /* __CLUTTER_BACKEND_DEPRECATED_H__ */

View file

@ -1,309 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-actor.h"
#include "clutter-alpha.h"
#include "clutter-behaviour.h"
#include "clutter-behaviour-depth.h"
#include "clutter-enum-types.h"
#include "clutter-main.h"
#include "clutter-debug.h"
#include "clutter-private.h"
/**
* SECTION:clutter-behaviour-depth
* @Title: ClutterBehaviourDepth
* @short_description: A behaviour controlling the Z position
* @Deprecated: 1.6: Use clutter_actor_animate() instead
*
* #ClutterBehaviourDepth is a simple #ClutterBehaviour controlling the
* depth of a set of actors between a start and end depth.
*
* #ClutterBehaviourDepth is available since Clutter 0.4.
*
* Deprecated: 1.6: Use the #ClutterActor:depth property and
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
* instead.
*/
G_DEFINE_TYPE (ClutterBehaviourDepth,
clutter_behaviour_depth,
CLUTTER_TYPE_BEHAVIOUR);
struct _ClutterBehaviourDepthPrivate
{
gint depth_start;
gint depth_end;
};
enum
{
PROP_0,
PROP_DEPTH_START,
PROP_DEPTH_END
};
static void
alpha_notify_foreach (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer user_data)
{
clutter_actor_set_depth (actor, GPOINTER_TO_INT (user_data));
}
static void
clutter_behaviour_depth_alpha_notify (ClutterBehaviour *behaviour,
gdouble alpha_value)
{
ClutterBehaviourDepthPrivate *priv;
gint depth;
priv = CLUTTER_BEHAVIOUR_DEPTH (behaviour)->priv;
/* Need to create factor as to avoid borking signedness */
depth = (alpha_value * (priv->depth_end - priv->depth_start))
+ priv->depth_start;
CLUTTER_NOTE (ANIMATION, "alpha: %.4f, depth: %d", alpha_value, depth);
clutter_behaviour_actors_foreach (behaviour,
alpha_notify_foreach,
GINT_TO_POINTER (depth));
}
static void
clutter_behaviour_depth_applied (ClutterBehaviour *behaviour,
ClutterActor *actor)
{
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (behaviour);
clutter_actor_set_depth (actor, depth->priv->depth_start);
}
static void
clutter_behaviour_depth_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (gobject);
switch (prop_id)
{
case PROP_DEPTH_START:
depth->priv->depth_start = g_value_get_int (value);
break;
case PROP_DEPTH_END:
depth->priv->depth_end = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_depth_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (gobject);
switch (prop_id)
{
case PROP_DEPTH_START:
g_value_set_int (value, depth->priv->depth_start);
break;
case PROP_DEPTH_END:
g_value_set_int (value, depth->priv->depth_end);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_depth_class_init (ClutterBehaviourDepthClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBehaviourClass *behaviour_class = CLUTTER_BEHAVIOUR_CLASS (klass);
g_type_class_add_private (klass, sizeof (ClutterBehaviourDepthPrivate));
gobject_class->set_property = clutter_behaviour_depth_set_property;
gobject_class->get_property = clutter_behaviour_depth_get_property;
behaviour_class->alpha_notify = clutter_behaviour_depth_alpha_notify;
behaviour_class->applied = clutter_behaviour_depth_applied;
/**
* ClutterBehaviourDepth:depth-start:
*
* Start depth level to apply to the actors.
*
*
*
* Deprecated: 1.6
*/
g_object_class_install_property (gobject_class,
PROP_DEPTH_START,
g_param_spec_int ("depth-start",
P_("Start Depth"),
P_("Initial depth to apply"),
G_MININT, G_MAXINT, 0,
CLUTTER_PARAM_READWRITE));
/**
* ClutterBehaviourDepth:depth-end:
*
* End depth level to apply to the actors.
*
*
*
* Deprecated: 1.6
*/
g_object_class_install_property (gobject_class,
PROP_DEPTH_END,
g_param_spec_int ("depth-end",
P_("End Depth"),
P_("Final depth to apply"),
G_MININT, G_MAXINT, 0,
CLUTTER_PARAM_READWRITE));
}
static void
clutter_behaviour_depth_init (ClutterBehaviourDepth *depth)
{
depth->priv = G_TYPE_INSTANCE_GET_PRIVATE (depth,
CLUTTER_TYPE_BEHAVIOUR_DEPTH,
ClutterBehaviourDepthPrivate);
}
/**
* clutter_behaviour_depth_new:
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
* @depth_start: initial value of the depth
* @depth_end: final value of the depth
*
* Creates a new #ClutterBehaviourDepth which can be used to control
* the ClutterActor:depth property of a set of #ClutterActor<!-- -->s.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
* it can be set later with clutter_behaviour_set_alpha().
*
* Return value: (transfer full): the newly created behaviour
*
*
*
* Deprecated: 1.6
*/
ClutterBehaviour *
clutter_behaviour_depth_new (ClutterAlpha *alpha,
gint depth_start,
gint depth_end)
{
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_DEPTH,
"alpha", alpha,
"depth-start", depth_start,
"depth-end", depth_end,
NULL);
}
/**
* clutter_behaviour_depth_set_bounds:
* @behaviour: a #ClutterBehaviourDepth
* @depth_start: initial value of the depth
* @depth_end: final value of the depth
*
* Sets the boundaries of the @behaviour.
*
*
*
* Deprecated: 1.6
*/
void
clutter_behaviour_depth_set_bounds (ClutterBehaviourDepth *behaviour,
gint depth_start,
gint depth_end)
{
ClutterBehaviourDepthPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_DEPTH (behaviour));
priv = behaviour->priv;
g_object_freeze_notify (G_OBJECT (behaviour));
if (priv->depth_start != depth_start)
{
priv->depth_start = depth_start;
g_object_notify (G_OBJECT (behaviour), "depth-start");
}
if (priv->depth_end != depth_end)
{
priv->depth_end = depth_end;
g_object_notify (G_OBJECT (behaviour), "depth-end");
}
g_object_thaw_notify (G_OBJECT (behaviour));
}
/**
* clutter_behaviour_depth_get_bounds:
* @behaviour: a #ClutterBehaviourDepth
* @depth_start: (out): return location for the initial depth value, or %NULL
* @depth_end: (out): return location for the final depth value, or %NULL
*
* Gets the boundaries of the @behaviour
*
*
*
* Deprecated: 1.6
*/
void
clutter_behaviour_depth_get_bounds (ClutterBehaviourDepth *behaviour,
gint *depth_start,
gint *depth_end)
{
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_DEPTH (behaviour));
if (depth_start)
*depth_start = behaviour->priv->depth_start;
if (depth_end)
*depth_end = behaviour->priv->depth_end;
}

View file

@ -1,101 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_DEPTH__
#define __CLUTTER_BEHAVIOUR_DEPTH__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_DEPTH (clutter_behaviour_depth_get_type ())
#define CLUTTER_BEHAVIOUR_DEPTH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepth))
#define CLUTTER_IS_BEHAVIOUR_DEPTH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH))
#define CLUTTER_BEHAVIOUR_DEPTH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepthClass))
#define CLUTTER_IS_BEHAVIOUR_DEPTH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_DEPTH))
#define CLUTTER_BEHAVIOUR_DEPTH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepthClass))
typedef struct _ClutterBehaviourDepth ClutterBehaviourDepth;
typedef struct _ClutterBehaviourDepthPrivate ClutterBehaviourDepthPrivate;
typedef struct _ClutterBehaviourDepthClass ClutterBehaviourDepthClass;
/**
* ClutterBehaviourDepth:
*
* The #ClutterBehaviourDepth structure contains only private data
* and should be accessed using the provided API
*
*
*
* Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:depth
* instead.
*/
struct _ClutterBehaviourDepth
{
/*< private >*/
ClutterBehaviour parent_instance;
ClutterBehaviourDepthPrivate *priv;
};
/**
* ClutterBehaviourDepthClass:
*
* The #ClutterBehaviourDepthClass structure contains only private data
*
*
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourDepthClass
{
/*< private >*/
ClutterBehaviourClass parent_class;
};
CLUTTER_DEPRECATED_IN_1_6
GType clutter_behaviour_depth_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_6_FOR(clutter_actor_animate and ClutterActor:depth)
ClutterBehaviour *clutter_behaviour_depth_new (ClutterAlpha *alpha,
gint depth_start,
gint depth_end);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_depth_set_bounds (ClutterBehaviourDepth *behaviour,
gint depth_start,
gint depth_end);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_depth_get_bounds (ClutterBehaviourDepth *behaviour,
gint *depth_start,
gint *depth_end);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_DEPTH__ */

File diff suppressed because it is too large Load diff

View file

@ -1,159 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Tomas Frydrych <tf@openedhand.com>
*
* Copyright (C) 2007 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_ELLIPSE_H__
#define __CLUTTER_BEHAVIOUR_ELLIPSE_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_ELLIPSE (clutter_behaviour_ellipse_get_type ())
#define CLUTTER_BEHAVIOUR_ELLIPSE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR_ELLIPSE, ClutterBehaviourEllipse))
#define CLUTTER_BEHAVIOUR_ELLIPSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR_ELLIPSE, ClutterBehaviourEllipseClass))
#define CLUTTER_IS_BEHAVIOUR_ELLIPSE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_ELLIPSE))
#define CLUTTER_IS_BEHAVIOUR_ELLIPSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR_ELLIPSE))
#define CLUTTER_BEHAVIOUR_ELLIPSE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR_ELLIPSE, ClutterBehaviourEllipseClass))
typedef struct _ClutterBehaviourEllipse ClutterBehaviourEllipse;
typedef struct _ClutterBehaviourEllipsePrivate ClutterBehaviourEllipsePrivate;
typedef struct _ClutterBehaviourEllipseClass ClutterBehaviourEllipseClass;
/**
* ClutterBehaviourEllipse:
*
* The #ClutterBehaviourEllipse struct contains only private data
* and should be accessed using the provided API
*
*
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourEllipse
{
/*< private >*/
ClutterBehaviour parent_instance;
ClutterBehaviourEllipsePrivate *priv;
};
/**
* ClutterBehaviourEllipseClass:
*
* The #ClutterBehaviourEllipseClass struct contains only private data
*
*
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourEllipseClass
{
/*< private >*/
ClutterBehaviourClass parent_class;
};
CLUTTER_DEPRECATED_IN_1_8
GType clutter_behaviour_ellipse_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_8_FOR(clutter_actor_animate)
ClutterBehaviour * clutter_behaviour_ellipse_new (ClutterAlpha *alpha,
gint x,
gint y,
gint width,
gint height,
ClutterRotateDirection direction,
gdouble start,
gdouble end);
CLUTTER_DEPRECATED_IN_1_8
void clutter_behaviour_ellipse_set_center (ClutterBehaviourEllipse *self,
gint x,
gint y);
CLUTTER_DEPRECATED_IN_1_8
void clutter_behaviour_ellipse_get_center (ClutterBehaviourEllipse *self,
gint *x,
gint *y);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_ellipse_set_width (ClutterBehaviourEllipse *self,
gint width);
CLUTTER_DEPRECATED_IN_1_6
gint clutter_behaviour_ellipse_get_width (ClutterBehaviourEllipse *self);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_ellipse_set_height (ClutterBehaviourEllipse *self,
gint height);
CLUTTER_DEPRECATED_IN_1_6
gint clutter_behaviour_ellipse_get_height (ClutterBehaviourEllipse *self);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_ellipse_set_angle_start (ClutterBehaviourEllipse *self,
gdouble angle_start);
CLUTTER_DEPRECATED_IN_1_6
gdouble clutter_behaviour_ellipse_get_angle_start (ClutterBehaviourEllipse *self);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_ellipse_set_angle_end (ClutterBehaviourEllipse *self,
gdouble angle_end);
CLUTTER_DEPRECATED_IN_1_6
gdouble clutter_behaviour_ellipse_get_angle_end (ClutterBehaviourEllipse *self);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_ellipse_set_angle_tilt (ClutterBehaviourEllipse *self,
ClutterRotateAxis axis,
gdouble angle_tilt);
CLUTTER_DEPRECATED_IN_1_6
gdouble clutter_behaviour_ellipse_get_angle_tilt (ClutterBehaviourEllipse *self,
ClutterRotateAxis axis);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_ellipse_set_tilt (ClutterBehaviourEllipse *self,
gdouble angle_tilt_x,
gdouble angle_tilt_y,
gdouble angle_tilt_z);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_ellipse_get_tilt (ClutterBehaviourEllipse *self,
gdouble *angle_tilt_x,
gdouble *angle_tilt_y,
gdouble *angle_tilt_z);
CLUTTER_DEPRECATED_IN_1_6
ClutterRotateDirection clutter_behaviour_ellipse_get_direction (ClutterBehaviourEllipse *self);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_ellipse_set_direction (ClutterBehaviourEllipse *self,
ClutterRotateDirection direction);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_ELLIPSE_H__ */

View file

@ -1,322 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-behaviour-opacity
* @Title: ClutterBehaviourOpacity
* @short_description: A behaviour controlling opacity
* @Deprecated: 1.6: Use clutter_actor_animate() instead.
*
* #ClutterBehaviourOpacity controls the opacity of a set of actors.
*
*
*
* Deprecated: 1.6: Use the #ClutterActor:opacity property and
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
* instead.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <math.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-alpha.h"
#include "clutter-behaviour.h"
#include "clutter-behaviour-opacity.h"
#include "clutter-private.h"
#include "clutter-debug.h"
G_DEFINE_TYPE (ClutterBehaviourOpacity,
clutter_behaviour_opacity,
CLUTTER_TYPE_BEHAVIOUR);
struct _ClutterBehaviourOpacityPrivate
{
guint8 opacity_start;
guint8 opacity_end;
};
#define CLUTTER_BEHAVIOUR_OPACITY_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, \
ClutterBehaviourOpacityPrivate))
enum
{
PROP_0,
PROP_OPACITY_START,
PROP_OPACITY_END,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
static void
alpha_notify_foreach (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer data)
{
clutter_actor_set_opacity (actor, GPOINTER_TO_UINT(data));
}
static void
clutter_behaviour_alpha_notify (ClutterBehaviour *behave,
gdouble alpha_value)
{
ClutterBehaviourOpacityPrivate *priv;
guint8 opacity;
priv = CLUTTER_BEHAVIOUR_OPACITY (behave)->priv;
opacity = alpha_value
* (priv->opacity_end - priv->opacity_start)
+ priv->opacity_start;
CLUTTER_NOTE (ANIMATION, "alpha: %.4f, opacity: %u",
alpha_value,
opacity);
clutter_behaviour_actors_foreach (behave,
alpha_notify_foreach,
GUINT_TO_POINTER ((guint) opacity));
}
static void
clutter_behaviour_opacity_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject);
switch (prop_id)
{
case PROP_OPACITY_START:
clutter_behaviour_opacity_set_bounds (self,
g_value_get_uint (value),
self->priv->opacity_end);
break;
case PROP_OPACITY_END:
clutter_behaviour_opacity_set_bounds (self,
self->priv->opacity_start,
g_value_get_uint (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_opacity_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject);
switch (prop_id)
{
case PROP_OPACITY_START:
g_value_set_uint (value, self->priv->opacity_start);
break;
case PROP_OPACITY_END:
g_value_set_uint (value, self->priv->opacity_end);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (klass, sizeof (ClutterBehaviourOpacityPrivate));
gobject_class->set_property = clutter_behaviour_opacity_set_property;
gobject_class->get_property = clutter_behaviour_opacity_get_property;
/**
* ClutterBehaviourOpacity:opacity-start:
*
* Initial opacity level of the behaviour.
*
*
*
* Deprecated: 1.6
*/
pspec = g_param_spec_uint ("opacity-start",
P_("Opacity Start"),
P_("Initial opacity level"),
0, 255,
0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_OPACITY_START] = pspec;
g_object_class_install_property (gobject_class, PROP_OPACITY_START, pspec);
/**
* ClutterBehaviourOpacity:opacity-end:
*
* Final opacity level of the behaviour.
*
*
*
* Deprecated: 1.6
*/
pspec = g_param_spec_uint ("opacity-end",
P_("Opacity End"),
P_("Final opacity level"),
0, 255,
0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_OPACITY_END] = pspec;
g_object_class_install_property (gobject_class, PROP_OPACITY_END, pspec);
behave_class->alpha_notify = clutter_behaviour_alpha_notify;
}
static void
clutter_behaviour_opacity_init (ClutterBehaviourOpacity *self)
{
self->priv = CLUTTER_BEHAVIOUR_OPACITY_GET_PRIVATE (self);
self->priv->opacity_start = 0;
self->priv->opacity_end = 0;
}
/**
* clutter_behaviour_opacity_new:
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
* @opacity_start: minimum level of opacity
* @opacity_end: maximum level of opacity
*
* Creates a new #ClutterBehaviourOpacity object, driven by @alpha
* which controls the opacity property of every actor, making it
* change in the interval between @opacity_start and @opacity_end.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
* it can be set later with clutter_behaviour_set_alpha().
*
* Return value: the newly created #ClutterBehaviourOpacity
*
*
*
* Deprecated: 1.6
*/
ClutterBehaviour *
clutter_behaviour_opacity_new (ClutterAlpha *alpha,
guint8 opacity_start,
guint8 opacity_end)
{
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_OPACITY,
"alpha", alpha,
"opacity-start", opacity_start,
"opacity-end", opacity_end,
NULL);
}
/**
* clutter_behaviour_opacity_set_bounds:
* @behaviour: a #ClutterBehaviourOpacity
* @opacity_start: minimum level of opacity
* @opacity_end: maximum level of opacity
*
* Sets the initial and final levels of the opacity applied by @behaviour
* on each actor it controls.
*
*
*
* Deprecated: 1.6
*/
void
clutter_behaviour_opacity_set_bounds (ClutterBehaviourOpacity *behaviour,
guint8 opacity_start,
guint8 opacity_end)
{
ClutterBehaviourOpacityPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour));
priv = behaviour->priv;
g_object_freeze_notify (G_OBJECT (behaviour));
if (priv->opacity_start != opacity_start)
{
priv->opacity_start = opacity_start;
g_object_notify_by_pspec (G_OBJECT (behaviour), obj_props[PROP_OPACITY_START]);
}
if (priv->opacity_end != opacity_end)
{
priv->opacity_end = opacity_end;
g_object_notify_by_pspec (G_OBJECT (behaviour), obj_props[PROP_OPACITY_END]);
}
g_object_thaw_notify (G_OBJECT (behaviour));
}
/**
* clutter_behaviour_opacity_get_bounds:
* @behaviour: a #ClutterBehaviourOpacity
* @opacity_start: (out): return location for the minimum level of opacity, or %NULL
* @opacity_end: (out): return location for the maximum level of opacity, or %NULL
*
* Gets the initial and final levels of the opacity applied by @behaviour
* on each actor it controls.
*
*
*
* Deprecated: 1.6
*/
void
clutter_behaviour_opacity_get_bounds (ClutterBehaviourOpacity *behaviour,
guint8 *opacity_start,
guint8 *opacity_end)
{
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour));
if (opacity_start)
*opacity_start = behaviour->priv->opacity_start;
if (opacity_end)
*opacity_end = behaviour->priv->opacity_end;
}

View file

@ -1,115 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_OPACITY_H__
#define __CLUTTER_BEHAVIOUR_OPACITY_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_OPACITY (clutter_behaviour_opacity_get_type ())
#define CLUTTER_BEHAVIOUR_OPACITY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacity))
#define CLUTTER_BEHAVIOUR_OPACITY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
#define CLUTTER_IS_BEHAVIOUR_OPACITY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
#define CLUTTER_IS_BEHAVIOUR_OPACITY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
#define CLUTTER_BEHAVIOUR_OPACITY_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
typedef struct _ClutterBehaviourOpacity ClutterBehaviourOpacity;
typedef struct _ClutterBehaviourOpacityPrivate ClutterBehaviourOpacityPrivate;
typedef struct _ClutterBehaviourOpacityClass ClutterBehaviourOpacityClass;
/**
* ClutterBehaviourOpacity:
*
* The #ClutterBehaviourOpacity structure contains only private data and
* should be accessed using the provided API
*
*
*
* Deprecated: 1.6: Use clutter_actor_animate() and #ClutterActor:opacity
* instead.
*/
struct _ClutterBehaviourOpacity
{
/*< private >*/
ClutterBehaviour parent;
ClutterBehaviourOpacityPrivate *priv;
};
/**
* ClutterBehaviourOpacityClass:
*
* The #ClutterBehaviourOpacityClass structure contains only private data
*
*
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourOpacityClass
{
/*< private >*/
ClutterBehaviourClass parent_class;
};
CLUTTER_DEPRECATED_IN_1_6
GType clutter_behaviour_opacity_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_6_FOR(clutter_actor_animate and ClutterActor:opacity)
ClutterBehaviour *clutter_behaviour_opacity_new (ClutterAlpha *alpha,
guint8 opacity_start,
guint8 opacity_end);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_opacity_set_bounds (ClutterBehaviourOpacity *behaviour,
guint8 opacity_start,
guint8 opacity_end);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_opacity_get_bounds (ClutterBehaviourOpacity *behaviour,
guint8 *opacity_start,
guint8 *opacity_end);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_OPACITY_H__ */

View file

@ -1,477 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By:
* Matthew Allum <mallum@openedhand.com>
* Neil Roberts <neil@linux.intel.com>
*
* Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
* Copyright (C) 2009, 2010 Intel Corp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-behaviour-path
* @Title: ClutterBehaviourPath
* @short_description: A behaviour for moving actors along a #ClutterPath
* @Deprecated: 1.6: Use #ClutterPathConstraint and clutter_actor_animate()
* with the #ClutterPathConstraint:offset property instead.
*
* #ClutterBehaviourPath interpolates actors along a defined path.
*
* A path is described by a #ClutterPath object. The path can contain
* straight line parts and bezier curves. If the path contains
* %CLUTTER_PATH_MOVE_TO parts then the actors will jump to those
* coordinates. This can be used make disjoint paths.
*
* When creating a path behaviour in a #ClutterScript, you can specify
* the path property directly as a string. For example:
*
* |[
* {
* "id" : "spline-path",
* "type" : "ClutterBehaviourPath",
* "path" : "M 50 50 L 100 100",
* "alpha" : {
* "timeline" : "main-timeline",
* "function" : "ramp
* }
* }
* ]|
*
* <note>If the alpha function is a periodic function, i.e. it returns to
* 0.0 after reaching 1.0, then the actors will walk the path back to the
* starting #ClutterKnot.</note>
*
* #ClutterBehaviourPath is available since Clutter 0.2
*
* Deprecated: 1.6: Use #ClutterPath and #ClutterPathConstraint with
* clutter_actor_animate() instead.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-alpha.h"
#include "clutter-behaviour.h"
#include "clutter-behaviour-path.h"
#include "clutter-bezier.h"
#include "clutter-debug.h"
#include "clutter-enum-types.h"
#include "clutter-main.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "clutter-script-private.h"
#include "clutter-scriptable.h"
#include <math.h>
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
G_DEFINE_TYPE_WITH_CODE (ClutterBehaviourPath,
clutter_behaviour_path,
CLUTTER_TYPE_BEHAVIOUR,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
clutter_scriptable_iface_init));
struct _ClutterBehaviourPathPrivate
{
ClutterPath *path;
guint last_knot_passed;
};
#define CLUTTER_BEHAVIOUR_PATH_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_PATH, \
ClutterBehaviourPathPrivate))
enum
{
KNOT_REACHED,
LAST_SIGNAL
};
static guint path_signals[LAST_SIGNAL] = { 0, };
enum
{
PROP_0,
PROP_PATH,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
static void
actor_apply_knot_foreach (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer data)
{
ClutterKnot *knot = data;
CLUTTER_NOTE (ANIMATION, "Setting actor to %ix%i", knot->x, knot->y);
clutter_actor_set_position (actor, knot->x, knot->y);
}
static void
clutter_behaviour_path_alpha_notify (ClutterBehaviour *behave,
gdouble alpha_value)
{
ClutterBehaviourPath *pathb = CLUTTER_BEHAVIOUR_PATH (behave);
ClutterBehaviourPathPrivate *priv = pathb->priv;
ClutterKnot position;
guint knot_num;
if (priv->path)
knot_num = clutter_path_get_position (priv->path, alpha_value, &position);
else
{
memset (&position, 0, sizeof (position));
knot_num = 0;
}
clutter_behaviour_actors_foreach (behave,
actor_apply_knot_foreach,
&position);
if (knot_num != priv->last_knot_passed)
{
g_signal_emit (behave, path_signals[KNOT_REACHED], 0, knot_num);
priv->last_knot_passed = knot_num;
}
}
static void
clutter_behaviour_path_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourPath *pathb = CLUTTER_BEHAVIOUR_PATH (gobject);
switch (prop_id)
{
case PROP_PATH:
g_value_set_object (value, clutter_behaviour_path_get_path (pathb));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_path_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourPath *pathb = CLUTTER_BEHAVIOUR_PATH (gobject);
switch (prop_id)
{
case PROP_PATH:
clutter_behaviour_path_set_path (pathb, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_path_dispose (GObject *gobject)
{
ClutterBehaviourPath *pathb = CLUTTER_BEHAVIOUR_PATH (gobject);
clutter_behaviour_path_set_path (pathb, NULL);
G_OBJECT_CLASS (clutter_behaviour_path_parent_class)->dispose (gobject);
}
static void
clutter_behaviour_path_class_init (ClutterBehaviourPathClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
GParamSpec *pspec;
gobject_class->get_property = clutter_behaviour_path_get_property;
gobject_class->set_property = clutter_behaviour_path_set_property;
gobject_class->dispose = clutter_behaviour_path_dispose;
pspec = g_param_spec_object ("path",
P_("Path"),
P_("The ClutterPath object representing the path "
"to animate along"),
CLUTTER_TYPE_PATH,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_PATH] = pspec;
g_object_class_install_property (gobject_class, PROP_PATH, pspec);
/**
* ClutterBehaviourPath::knot-reached:
* @pathb: the object which received the signal
* @knot_num: the index of the #ClutterKnot reached
*
* This signal is emitted each time a node defined inside the path
* is reached.
*
*
*
* Deprecated: 1.6
*/
path_signals[KNOT_REACHED] =
g_signal_new ("knot-reached",
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterBehaviourPathClass, knot_reached),
NULL, NULL,
_clutter_marshal_VOID__UINT,
G_TYPE_NONE, 1,
G_TYPE_UINT);
behave_class->alpha_notify = clutter_behaviour_path_alpha_notify;
g_type_class_add_private (klass, sizeof (ClutterBehaviourPathPrivate));
}
static ClutterScriptableIface *parent_scriptable_iface = NULL;
static gboolean
clutter_behaviour_path_parse_custom_node (ClutterScriptable *scriptable,
ClutterScript *script,
GValue *value,
const gchar *name,
JsonNode *node)
{
if (strcmp ("path", name) == 0)
{
ClutterPath *path;
GValue node_value = { 0 };
path = g_object_ref_sink (clutter_path_new ());
json_node_get_value (node, &node_value);
if (!G_VALUE_HOLDS (&node_value, G_TYPE_STRING)
|| !clutter_path_set_description (path,
g_value_get_string (&node_value)))
g_warning ("Invalid path description");
g_value_unset (&node_value);
g_value_init (value, G_TYPE_OBJECT);
g_value_take_object (value, path);
return TRUE;
}
/* chain up */
else if (parent_scriptable_iface->parse_custom_node)
return parent_scriptable_iface->parse_custom_node (scriptable, script,
value, name, node);
else
return FALSE;
}
static void
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
{
parent_scriptable_iface = g_type_interface_peek_parent (iface);
if (!parent_scriptable_iface)
parent_scriptable_iface
= g_type_default_interface_peek (CLUTTER_TYPE_SCRIPTABLE);
iface->parse_custom_node = clutter_behaviour_path_parse_custom_node;
}
static void
clutter_behaviour_path_init (ClutterBehaviourPath *self)
{
ClutterBehaviourPathPrivate *priv;
self->priv = priv = CLUTTER_BEHAVIOUR_PATH_GET_PRIVATE (self);
priv->path = NULL;
priv->last_knot_passed = G_MAXUINT;
}
/**
* clutter_behaviour_path_new:
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
* @path: a #ClutterPath or %NULL for an empty path
*
* Creates a new path behaviour. You can use this behaviour to drive
* actors along the nodes of a path, described by @path.
*
* This will claim the floating reference on the #ClutterPath so you
* do not need to unref if it.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
* it can be set later with clutter_behaviour_set_alpha().
*
* Return value: (transfer full): a #ClutterBehaviour
*
*
*
* Deprecated: 1.6
*/
ClutterBehaviour *
clutter_behaviour_path_new (ClutterAlpha *alpha,
ClutterPath *path)
{
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_PATH,
"alpha", alpha,
"path", path,
NULL);
}
/**
* clutter_behaviour_path_new_with_description:
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
* @desc: a string description of the path
*
* Creates a new path behaviour using the path described by @desc. See
* clutter_path_add_string() for a description of the format.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
* it can be set later with clutter_behaviour_set_alpha().
*
* Return value: (transfer full): a #ClutterBehaviour
*
*
*
* Deprecated: 1.6
*/
ClutterBehaviour *
clutter_behaviour_path_new_with_description (ClutterAlpha *alpha,
const gchar *desc)
{
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_PATH,
"alpha", alpha,
"path", clutter_path_new_with_description (desc),
NULL);
}
/**
* clutter_behaviour_path_new_with_knots:
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
* @knots: (array length=n_knots): an array of #ClutterKnot<!-- -->s
* @n_knots: number of entries in @knots
*
* Creates a new path behaviour that will make the actors visit all of
* the given knots in order with straight lines in between.
*
* A path will be created where the first knot is used in a
* %CLUTTER_PATH_MOVE_TO and the subsequent knots are used in
* %CLUTTER_PATH_LINE_TO<!-- -->s.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
* it can be set later with clutter_behaviour_set_alpha().
*
* Return value: (transfer full): a #ClutterBehaviour
*
*
*
* Deprecated: 1.6
*/
ClutterBehaviour *
clutter_behaviour_path_new_with_knots (ClutterAlpha *alpha,
const ClutterKnot *knots,
guint n_knots)
{
ClutterPath *path = clutter_path_new ();
guint i;
if (n_knots > 0)
{
clutter_path_add_move_to (path, knots[0].x, knots[0].y);
for (i = 1; i < n_knots; i++)
clutter_path_add_line_to (path, knots[i].x, knots[i].y);
}
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_PATH,
"alpha", alpha,
"path", path,
NULL);
}
/**
* clutter_behaviour_path_set_path:
* @pathb: the path behaviour
* @path: the new path to follow
*
* Change the path that the actors will follow. This will take the
* floating reference on the #ClutterPath so you do not need to unref
* it.
*
*
*
* Deprecated: 1.6
*/
void
clutter_behaviour_path_set_path (ClutterBehaviourPath *pathb,
ClutterPath *path)
{
ClutterBehaviourPathPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_PATH (pathb));
priv = pathb->priv;
if (path)
g_object_ref_sink (path);
if (priv->path)
g_object_unref (priv->path);
priv->path = path;
g_object_notify_by_pspec (G_OBJECT (pathb), obj_props[PROP_PATH]);
}
/**
* clutter_behaviour_path_get_path:
* @pathb: a #ClutterBehaviourPath instance
*
* Get the current path of the behaviour
*
* Return value: (transfer none): the path
*
*
*
* Deprecated: 1.6
*/
ClutterPath *
clutter_behaviour_path_get_path (ClutterBehaviourPath *pathb)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_PATH (pathb), NULL);
return pathb->priv->path;
}

View file

@ -1,135 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_PATH_H__
#define __CLUTTER_BEHAVIOUR_PATH_H__
#include <clutter/clutter-types.h>
#include <clutter/clutter-path.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_PATH (clutter_behaviour_path_get_type ())
#define CLUTTER_BEHAVIOUR_PATH(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR_PATH, ClutterBehaviourPath))
#define CLUTTER_BEHAVIOUR_PATH_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR_PATH, ClutterBehaviourPathClass))
#define CLUTTER_IS_BEHAVIOUR_PATH(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_PATH))
#define CLUTTER_IS_BEHAVIOUR_PATH_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR_PATH))
#define CLUTTER_BEHAVIOUR_PATH_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR_PATH, ClutterBehaviourPathClass))
typedef struct _ClutterBehaviourPath ClutterBehaviourPath;
typedef struct _ClutterBehaviourPathPrivate ClutterBehaviourPathPrivate;
typedef struct _ClutterBehaviourPathClass ClutterBehaviourPathClass;
/**
* ClutterBehaviourPath:
*
* The #ClutterBehaviourPath structure contains only private data
* and should be accessed using the provided API
*
*
*
* Deprecated: 1.6: Use #ClutterPathConstraint and clutter_actor_animate()
* instead.
*/
struct _ClutterBehaviourPath
{
/*< private >*/
ClutterBehaviour parent;
ClutterBehaviourPathPrivate *priv;
};
/**
* ClutterBehaviourPathClass:
* @knot_reached: signal class handler for the
* ClutterBehaviourPath::knot_reached signal
*
* The #ClutterBehaviourPathClass struct contains only private data
*
*
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourPathClass
{
/*< private >*/
ClutterBehaviourClass parent_class;
/*< public >*/
void (*knot_reached) (ClutterBehaviourPath *pathb,
guint knot_num);
/*< private >*/
void (*_clutter_path_1) (void);
void (*_clutter_path_2) (void);
void (*_clutter_path_3) (void);
void (*_clutter_path_4) (void);
};
CLUTTER_DEPRECATED_IN_1_6
GType clutter_behaviour_path_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_6_FOR(clutter_actor_animate)
ClutterBehaviour *clutter_behaviour_path_new (ClutterAlpha *alpha,
ClutterPath *path);
CLUTTER_DEPRECATED_IN_1_6_FOR(clutter_actor_animate)
ClutterBehaviour *clutter_behaviour_path_new_with_description
(ClutterAlpha *alpha,
const gchar *desc);
CLUTTER_DEPRECATED_IN_1_6_FOR(clutter_actor_animate)
ClutterBehaviour *clutter_behaviour_path_new_with_knots
(ClutterAlpha *alpha,
const ClutterKnot *knots,
guint n_knots);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_path_set_path (ClutterBehaviourPath *pathb,
ClutterPath *path);
CLUTTER_DEPRECATED_IN_1_6
ClutterPath * clutter_behaviour_path_get_path (ClutterBehaviourPath *pathb);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_PATH_H__ */

View file

@ -1,697 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2007 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-behaviour-rotate
* @short_description: A behaviour controlling rotation
*
* A #ClutterBehaviourRotate rotate actors between a starting and ending
* angle on a given axis.
*
* The #ClutterBehaviourRotate is available since version 0.4.
*
* Deprecated: 1.6: Use the #ClutterActor rotation properties and
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
* instead.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <math.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-actor.h"
#include "clutter-alpha.h"
#include "clutter-behaviour.h"
#include "clutter-behaviour-rotate.h"
#include "clutter-debug.h"
#include "clutter-enum-types.h"
#include "clutter-main.h"
#include "clutter-private.h"
G_DEFINE_TYPE (ClutterBehaviourRotate,
clutter_behaviour_rotate,
CLUTTER_TYPE_BEHAVIOUR);
struct _ClutterBehaviourRotatePrivate
{
gdouble angle_start;
gdouble angle_end;
ClutterRotateAxis axis;
ClutterRotateDirection direction;
gint center_x;
gint center_y;
gint center_z;
};
#define CLUTTER_BEHAVIOUR_ROTATE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_ROTATE, \
ClutterBehaviourRotatePrivate))
enum
{
PROP_0,
PROP_ANGLE_START,
PROP_ANGLE_END,
PROP_AXIS,
PROP_DIRECTION,
PROP_CENTER_X,
PROP_CENTER_Y,
PROP_CENTER_Z,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
typedef struct {
gdouble angle;
} RotateFrameClosure;
static void
alpha_notify_foreach (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer data)
{
RotateFrameClosure *closure = data;
ClutterBehaviourRotate *rotate_behaviour;
ClutterBehaviourRotatePrivate *priv;
rotate_behaviour = CLUTTER_BEHAVIOUR_ROTATE (behaviour);
priv = rotate_behaviour->priv;
clutter_actor_set_rotation (actor, priv->axis,
closure->angle,
priv->center_x,
priv->center_y,
priv->center_z);
}
static inline float
clamp_angle (float a)
{
float a1, a2;
gint rounds;
rounds = a / 360.0;
a1 = rounds * 360.0;
a2 = a - a1;
return a2;
}
static void
clutter_behaviour_rotate_alpha_notify (ClutterBehaviour *behaviour,
gdouble alpha_value)
{
ClutterBehaviourRotate *rotate_behaviour;
ClutterBehaviourRotatePrivate *priv;
RotateFrameClosure closure;
gdouble start, end;
rotate_behaviour = CLUTTER_BEHAVIOUR_ROTATE (behaviour);
priv = rotate_behaviour->priv;
closure.angle = 0;
start = priv->angle_start;
end = priv->angle_end;
if (priv->direction == CLUTTER_ROTATE_CW && start >= end)
end += 360.0;
else if (priv->direction == CLUTTER_ROTATE_CCW && start <= end)
end -= 360.0;
closure.angle = (end - start) * alpha_value + start;
clutter_behaviour_actors_foreach (behaviour,
alpha_notify_foreach,
&closure);
}
static void
clutter_behaviour_rotate_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourRotate *rotate;
ClutterBehaviourRotatePrivate *priv;
rotate = CLUTTER_BEHAVIOUR_ROTATE (gobject);
priv = rotate->priv;
switch (prop_id)
{
case PROP_ANGLE_START:
priv->angle_start = g_value_get_double (value);
break;
case PROP_ANGLE_END:
priv->angle_end = g_value_get_double (value);
break;
case PROP_AXIS:
priv->axis = g_value_get_enum (value);
break;
case PROP_DIRECTION:
priv->direction = g_value_get_enum (value);
break;
case PROP_CENTER_X:
clutter_behaviour_rotate_set_center (rotate,
g_value_get_int (value),
priv->center_y,
priv->center_z);
break;
case PROP_CENTER_Y:
clutter_behaviour_rotate_set_center (rotate,
priv->center_x,
g_value_get_int (value),
priv->center_z);
break;
case PROP_CENTER_Z:
clutter_behaviour_rotate_set_center (rotate,
priv->center_x,
priv->center_y,
g_value_get_int (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_rotate_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourRotatePrivate *priv;
priv = CLUTTER_BEHAVIOUR_ROTATE (gobject)->priv;
switch (prop_id)
{
case PROP_ANGLE_START:
g_value_set_double (value, priv->angle_start);
break;
case PROP_ANGLE_END:
g_value_set_double (value, priv->angle_end);
break;
case PROP_AXIS:
g_value_set_enum (value, priv->axis);
break;
case PROP_DIRECTION:
g_value_set_enum (value, priv->direction);
break;
case PROP_CENTER_X:
g_value_set_int (value, priv->center_x);
break;
case PROP_CENTER_Y:
g_value_set_int (value, priv->center_y);
break;
case PROP_CENTER_Z:
g_value_set_int (value, priv->center_z);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_rotate_class_init (ClutterBehaviourRotateClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBehaviourClass *behaviour_class = CLUTTER_BEHAVIOUR_CLASS (klass);
GParamSpec *pspec = NULL;
g_type_class_add_private (klass, sizeof (ClutterBehaviourRotatePrivate));
gobject_class->set_property = clutter_behaviour_rotate_set_property;
gobject_class->get_property = clutter_behaviour_rotate_get_property;
behaviour_class->alpha_notify = clutter_behaviour_rotate_alpha_notify;
/**
* ClutterBehaviourRotate:angle-start:
*
* The initial angle from whence the rotation should start.
*
*
*/
pspec = g_param_spec_double ("angle-start",
P_("Angle Begin"),
P_("Initial angle"),
0.0, 360.0,
0.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_ANGLE_START] = pspec;
g_object_class_install_property (gobject_class,
PROP_ANGLE_START,
pspec);
/**
* ClutterBehaviourRotate:angle-end:
*
* The final angle to where the rotation should end.
*
*
*/
pspec = g_param_spec_double ("angle-end",
P_("Angle End"),
P_("Final angle"),
0.0, 360.0,
0.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_ANGLE_END] = pspec;
g_object_class_install_property (gobject_class,
PROP_ANGLE_END,
pspec);
/**
* ClutterBehaviourRotate:axis:
*
* The axis of rotation.
*
*
*/
pspec = g_param_spec_enum ("axis",
P_("Axis"),
P_("Axis of rotation"),
CLUTTER_TYPE_ROTATE_AXIS,
CLUTTER_Z_AXIS,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_AXIS] = pspec;
g_object_class_install_property (gobject_class,
PROP_AXIS,
pspec);
/**
* ClutterBehaviourRotate:direction:
*
* The direction of the rotation.
*
*
*/
pspec = g_param_spec_enum ("direction",
P_("Direction"),
P_("Direction of rotation"),
CLUTTER_TYPE_ROTATE_DIRECTION,
CLUTTER_ROTATE_CW,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_DIRECTION] = pspec;
g_object_class_install_property (gobject_class,
PROP_DIRECTION,
pspec);
/**
* ClutterBehaviourRotate:center-x:
*
* The x center of rotation.
*
*
*/
pspec = g_param_spec_int ("center-x",
P_("Center X"),
P_("X coordinate of the center of rotation"),
-G_MAXINT, G_MAXINT,
0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_CENTER_X] = pspec;
g_object_class_install_property (gobject_class,
PROP_CENTER_X,
pspec);
/**
* ClutterBehaviourRotate:center-y:
*
* The y center of rotation.
*
*
*/
pspec = g_param_spec_int ("center-y",
P_("Center Y"),
P_("Y coordinate of the center of rotation"),
-G_MAXINT, G_MAXINT,
0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_CENTER_Y] = pspec;
g_object_class_install_property (gobject_class,
PROP_CENTER_Y,
pspec);
/**
* ClutterBehaviourRotate:center-z:
*
* The z center of rotation.
*
*
*/
pspec = g_param_spec_int ("center-z",
P_("Center Z"),
P_("Z coordinate of the center of rotation"),
-G_MAXINT, G_MAXINT,
0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_CENTER_Z] = pspec;
g_object_class_install_property (gobject_class,
PROP_CENTER_Z,
pspec);
}
static void
clutter_behaviour_rotate_init (ClutterBehaviourRotate *rotate)
{
ClutterBehaviourRotatePrivate *priv;
rotate->priv = priv = CLUTTER_BEHAVIOUR_ROTATE_GET_PRIVATE (rotate);
priv->angle_start = priv->angle_end = 0;
priv->axis = CLUTTER_Z_AXIS;
priv->direction = CLUTTER_ROTATE_CW;
priv->center_x = priv->center_y = priv->center_z = 0;
}
/**
* clutter_behaviour_rotate_new:
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
* @axis: the rotation axis
* @direction: the rotation direction
* @angle_start: the starting angle in degrees, between 0 and 360.
* @angle_end: the final angle in degrees, between 0 and 360.
*
* Creates a new #ClutterBehaviourRotate. This behaviour will rotate actors
* bound to it on @axis, following @direction, between @angle_start and
* @angle_end. Angles >= 360 degrees will be clamped to the canonical interval
* <0, 360), if angle_start == angle_end, the behaviour will carry out a
* single rotation of 360 degrees.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
* it can be set later with clutter_behaviour_set_alpha().
*
* Return value: the newly created #ClutterBehaviourRotate.
*
*
*/
ClutterBehaviour *
clutter_behaviour_rotate_new (ClutterAlpha *alpha,
ClutterRotateAxis axis,
ClutterRotateDirection direction,
gdouble angle_start,
gdouble angle_end)
{
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_ROTATE,
"alpha", alpha,
"axis", axis,
"direction", direction,
"angle-start", angle_start,
"angle-end", angle_end,
NULL);
}
/**
* clutter_behaviour_rotate_get_axis:
* @rotate: a #ClutterBehaviourRotate
*
* Retrieves the #ClutterRotateAxis used by the rotate behaviour.
*
* Return value: the rotation axis
*
*
*/
ClutterRotateAxis
clutter_behaviour_rotate_get_axis (ClutterBehaviourRotate *rotate)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate), CLUTTER_Z_AXIS);
return rotate->priv->axis;
}
/**
* clutter_behaviour_rotate_set_axis:
* @rotate: a #ClutterBehaviourRotate
* @axis: a #ClutterRotateAxis
*
* Sets the axis used by the rotate behaviour.
*
*
*/
void
clutter_behaviour_rotate_set_axis (ClutterBehaviourRotate *rotate,
ClutterRotateAxis axis)
{
ClutterBehaviourRotatePrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate));
priv = rotate->priv;
if (priv->axis != axis)
{
priv->axis = axis;
g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_AXIS]);
}
}
/**
* clutter_behaviour_rotate_get_direction:
* @rotate: a #ClutterBehaviourRotate
*
* Retrieves the #ClutterRotateDirection used by the rotate behaviour.
*
* Return value: the rotation direction
*
*
*/
ClutterRotateDirection
clutter_behaviour_rotate_get_direction (ClutterBehaviourRotate *rotate)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate),
CLUTTER_ROTATE_CW);
return rotate->priv->direction;
}
/**
* clutter_behaviour_rotate_set_direction:
* @rotate: a #ClutterBehaviourRotate
* @direction: the rotation direction
*
* Sets the rotation direction used by the rotate behaviour.
*
*
*/
void
clutter_behaviour_rotate_set_direction (ClutterBehaviourRotate *rotate,
ClutterRotateDirection direction)
{
ClutterBehaviourRotatePrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate));
priv = rotate->priv;
if (priv->direction != direction)
{
priv->direction = direction;
g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_DIRECTION]);
}
}
/**
* clutter_behaviour_rotate_get_bounds:
* @rotate: a #ClutterBehaviourRotate
* @angle_start: (out): return value for the initial angle
* @angle_end: (out): return value for the final angle
*
* Retrieves the rotation boundaries of the rotate behaviour.
*
*
*/
void
clutter_behaviour_rotate_get_bounds (ClutterBehaviourRotate *rotate,
gdouble *angle_start,
gdouble *angle_end)
{
ClutterBehaviourRotatePrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate));
priv = rotate->priv;
if (angle_start)
*angle_start = priv->angle_start;
if (angle_end)
*angle_end = priv->angle_end;
}
/**
* clutter_behaviour_rotate_set_bounds:
* @rotate: a #ClutterBehaviourRotate
* @angle_start: initial angle in degrees, between 0 and 360.
* @angle_end: final angle in degrees, between 0 and 360.
*
* Sets the initial and final angles of a rotation behaviour; angles >= 360
* degrees get clamped to the canonical interval <0, 360).
*
*
*/
void
clutter_behaviour_rotate_set_bounds (ClutterBehaviourRotate *rotate,
gdouble angle_start,
gdouble angle_end)
{
ClutterBehaviourRotatePrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate));
priv = rotate->priv;
g_object_freeze_notify (G_OBJECT (rotate));
if (priv->angle_start != angle_start)
{
priv->angle_start = clamp_angle (angle_start);
g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_ANGLE_START]);
}
if (priv->angle_end != angle_end)
{
priv->angle_end = clamp_angle (angle_end);
g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_ANGLE_END]);
}
g_object_thaw_notify (G_OBJECT (rotate));
}
/**
* clutter_behaviour_rotate_set_center:
* @rotate: a #ClutterBehaviourRotate
* @x: X axis center of rotation
* @y: Y axis center of rotation
* @z: Z axis center of rotation
*
* Sets the center of rotation. The coordinates are relative to the plane
* normal to the rotation axis set with clutter_behaviour_rotate_set_axis().
*
*
*/
void
clutter_behaviour_rotate_set_center (ClutterBehaviourRotate *rotate,
gint x,
gint y,
gint z)
{
ClutterBehaviourRotatePrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate));
priv = rotate->priv;
g_object_freeze_notify (G_OBJECT (rotate));
if (priv->center_x != x)
{
priv->center_x = x;
g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_CENTER_X]);
}
if (priv->center_y != y)
{
priv->center_y = y;
g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_CENTER_Y]);
}
if (priv->center_z != z)
{
priv->center_z = z;
g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_CENTER_Z]);
}
g_object_thaw_notify (G_OBJECT (rotate));
}
/**
* clutter_behaviour_rotate_get_center:
* @rotate: a #ClutterBehaviourRotate
* @x: (out): return location for the X center of rotation
* @y: (out): return location for the Y center of rotation
* @z: (out): return location for the Z center of rotation
*
* Retrieves the center of rotation set using
* clutter_behaviour_rotate_set_center().
*
*
*/
void
clutter_behaviour_rotate_get_center (ClutterBehaviourRotate *rotate,
gint *x,
gint *y,
gint *z)
{
ClutterBehaviourRotatePrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate));
priv = rotate->priv;
if (x)
*x = priv->center_x;
if (y)
*y = priv->center_y;
if (z)
*z = priv->center_z;
}

View file

@ -1,119 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2007 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_ROTATE_H__
#define __CLUTTER_BEHAVIOUR_ROTATE_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_ROTATE (clutter_behaviour_rotate_get_type ())
#define CLUTTER_BEHAVIOUR_ROTATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BEHAVIOUR_ROTATE, ClutterBehaviourRotate))
#define CLUTTER_IS_BEHAVIOUR_ROTATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BEHAVIOUR_ROTATE))
#define CLUTTER_BEHAVIOUR_ROTATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BEHAVIOUR_ROTATE, ClutterBehaviourRotateClass))
#define CLUTTER_IS_BEHAVIOUR_ROTATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_ROTATE))
#define CLUTTER_BEHAVIOUR_ROTATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((klass), CLUTTER_TYPE_BEHAVIOUR_ROTATE, ClutterBehaviourRotateClass))
typedef struct _ClutterBehaviourRotate ClutterBehaviourRotate;
typedef struct _ClutterBehaviourRotatePrivate ClutterBehaviourRotatePrivate;
typedef struct _ClutterBehaviourRotateClass ClutterBehaviourRotateClass;
/**
* ClutterBehaviourRotate:
*
* The #ClutterBehaviourRotate struct contains only private data and
* should be accessed using the provided API
*
*
*
* Deprecated: 1.6: Use clutter_actor_animate() instead.
*/
struct _ClutterBehaviourRotate
{
/*< private >*/
ClutterBehaviour parent_instance;
ClutterBehaviourRotatePrivate *priv;
};
/**
* ClutterBehaviourRotateClass:
*
* The #ClutterBehaviourRotateClass struct contains only private data
*
*
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourRotateClass
{
/*< private >*/
ClutterBehaviourClass parent_class;
};
CLUTTER_DEPRECATED_IN_1_6
GType clutter_behaviour_rotate_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_6_FOR(clutter_actor_animate)
ClutterBehaviour * clutter_behaviour_rotate_new (ClutterAlpha *alpha,
ClutterRotateAxis axis,
ClutterRotateDirection direction,
gdouble angle_start,
gdouble angle_end);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_rotate_get_center (ClutterBehaviourRotate *rotate,
gint *x,
gint *y,
gint *z);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_rotate_set_center (ClutterBehaviourRotate *rotate,
gint x,
gint y,
gint z);
CLUTTER_DEPRECATED_IN_1_6
ClutterRotateAxis clutter_behaviour_rotate_get_axis (ClutterBehaviourRotate *rotate);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_rotate_set_axis (ClutterBehaviourRotate *rotate,
ClutterRotateAxis axis);
CLUTTER_DEPRECATED_IN_1_6
ClutterRotateDirection clutter_behaviour_rotate_get_direction (ClutterBehaviourRotate *rotate);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_rotate_set_direction (ClutterBehaviourRotate *rotate,
ClutterRotateDirection direction);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_rotate_get_bounds (ClutterBehaviourRotate *rotate,
gdouble *angle_start,
gdouble *angle_end);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_rotate_set_bounds (ClutterBehaviourRotate *rotate,
gdouble angle_start,
gdouble angle_end);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_ROTATE_H__ */

View file

@ -1,443 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-behaviour-scale
* @Title: ClutterBehaviourScale
* @short_description: A behaviour controlling scale
* @Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:scale-x
* and #ClutterActor:scale-y instead.
*
* A #ClutterBehaviourScale interpolates actors size between two values.
*
* Deprecated: 1.6: Use the #ClutterActor:scale-x and #ClutterActor:scale-y
* properties, and clutter_actor_animate(), or #ClutterAnimator or
* #ClutterState instead.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <math.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-actor.h"
#include "clutter-alpha.h"
#include "clutter-behaviour.h"
#include "clutter-behaviour-scale.h"
#include "clutter-debug.h"
#include "clutter-main.h"
#include "clutter-private.h"
G_DEFINE_TYPE (ClutterBehaviourScale,
clutter_behaviour_scale,
CLUTTER_TYPE_BEHAVIOUR);
struct _ClutterBehaviourScalePrivate
{
gdouble x_scale_start;
gdouble y_scale_start;
gdouble x_scale_end;
gdouble y_scale_end;
};
#define CLUTTER_BEHAVIOUR_SCALE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScalePrivate))
enum
{
PROP_0,
PROP_X_SCALE_START,
PROP_Y_SCALE_START,
PROP_X_SCALE_END,
PROP_Y_SCALE_END,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
typedef struct {
gdouble scale_x;
gdouble scale_y;
} ScaleFrameClosure;
static void
scale_frame_foreach (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer data)
{
ScaleFrameClosure *closure = data;
clutter_actor_set_scale (actor, closure->scale_x, closure->scale_y);
}
static void
clutter_behaviour_scale_alpha_notify (ClutterBehaviour *behave,
gdouble alpha_value)
{
ClutterBehaviourScalePrivate *priv;
ScaleFrameClosure closure = { 0, };
priv = CLUTTER_BEHAVIOUR_SCALE (behave)->priv;
/* Fix the start/end values, avoids potential rounding errors on large
* values.
*/
if (alpha_value == 1.0)
{
closure.scale_x = priv->x_scale_end;
closure.scale_y = priv->y_scale_end;
}
else if (alpha_value == 0)
{
closure.scale_x = priv->x_scale_start;
closure.scale_y = priv->y_scale_start;
}
else
{
closure.scale_x = (priv->x_scale_end - priv->x_scale_start)
* alpha_value
+ priv->x_scale_start;
closure.scale_y = (priv->y_scale_end - priv->y_scale_start)
* alpha_value
+ priv->y_scale_start;
}
clutter_behaviour_actors_foreach (behave,
scale_frame_foreach,
&closure);
}
static void
clutter_behaviour_scale_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourScalePrivate *priv;
priv = CLUTTER_BEHAVIOUR_SCALE (gobject)->priv;
switch (prop_id)
{
case PROP_X_SCALE_START:
priv->x_scale_start = g_value_get_double (value);
break;
case PROP_X_SCALE_END:
priv->x_scale_end = g_value_get_double (value);
break;
case PROP_Y_SCALE_START:
priv->y_scale_start = g_value_get_double (value);
break;
case PROP_Y_SCALE_END:
priv->y_scale_end = g_value_get_double (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_scale_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourScalePrivate *priv;
priv = CLUTTER_BEHAVIOUR_SCALE (gobject)->priv;
switch (prop_id)
{
case PROP_X_SCALE_START:
g_value_set_double (value, priv->x_scale_start);
break;
case PROP_X_SCALE_END:
g_value_set_double (value, priv->x_scale_end);
break;
case PROP_Y_SCALE_START:
g_value_set_double (value, priv->y_scale_start);
break;
case PROP_Y_SCALE_END:
g_value_set_double (value, priv->y_scale_end);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
GParamSpec *pspec = NULL;
g_type_class_add_private (klass, sizeof (ClutterBehaviourScalePrivate));
gobject_class->set_property = clutter_behaviour_scale_set_property;
gobject_class->get_property = clutter_behaviour_scale_get_property;
/**
* ClutterBehaviourScale:x-scale-start:
*
* The initial scaling factor on the X axis for the actors.
*
*
*
* Deprecated: 1.6
*/
pspec = g_param_spec_double ("x-scale-start",
P_("X Start Scale"),
P_("Initial scale on the X axis"),
0.0, G_MAXDOUBLE,
1.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_X_SCALE_START] = pspec;
g_object_class_install_property (gobject_class,
PROP_X_SCALE_START,
pspec);
/**
* ClutterBehaviourScale:x-scale-end:
*
* The final scaling factor on the X axis for the actors.
*
*
*
* Deprecated: 1.6
*/
pspec = g_param_spec_double ("x-scale-end",
P_("X End Scale"),
P_("Final scale on the X axis"),
0.0, G_MAXDOUBLE,
1.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_X_SCALE_END] = pspec;
g_object_class_install_property (gobject_class,
PROP_X_SCALE_END,
pspec);
/**
* ClutterBehaviourScale:y-scale-start:
*
* The initial scaling factor on the Y axis for the actors.
*
*
*
* Deprecated: 1.6
*/
pspec = g_param_spec_double ("y-scale-start",
P_("Y Start Scale"),
P_("Initial scale on the Y axis"),
0.0, G_MAXDOUBLE,
1.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_Y_SCALE_START] = pspec;
g_object_class_install_property (gobject_class,
PROP_Y_SCALE_START,
pspec);
/**
* ClutterBehaviourScale:y-scale-end:
*
* The final scaling factor on the Y axis for the actors.
*
*
*
* Deprecated: 1.6
*/
pspec = g_param_spec_double ("y-scale-end",
P_("Y End Scale"),
P_("Final scale on the Y axis"),
0.0, G_MAXDOUBLE,
1.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_Y_SCALE_END] = pspec;
g_object_class_install_property (gobject_class,
PROP_Y_SCALE_END,
pspec);
behave_class->alpha_notify = clutter_behaviour_scale_alpha_notify;
}
static void
clutter_behaviour_scale_init (ClutterBehaviourScale *self)
{
ClutterBehaviourScalePrivate *priv;
self->priv = priv = CLUTTER_BEHAVIOUR_SCALE_GET_PRIVATE (self);
priv->x_scale_start = priv->x_scale_end = 1.0;
priv->y_scale_start = priv->y_scale_end = 1.0;
}
/**
* clutter_behaviour_scale_new:
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
* @x_scale_start: initial scale factor on the X axis
* @y_scale_start: initial scale factor on the Y axis
* @x_scale_end: final scale factor on the X axis
* @y_scale_end: final scale factor on the Y axis
*
* Creates a new #ClutterBehaviourScale instance.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
* it can be set later with clutter_behaviour_set_alpha().
*
* Return value: (transfer full): the newly created #ClutterBehaviourScale
*
*
*
* Deprecated: 1.6
*/
ClutterBehaviour *
clutter_behaviour_scale_new (ClutterAlpha *alpha,
gdouble x_scale_start,
gdouble y_scale_start,
gdouble x_scale_end,
gdouble y_scale_end)
{
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_SCALE,
"alpha", alpha,
"x-scale-start", x_scale_start,
"y-scale-start", y_scale_start,
"x-scale-end", x_scale_end,
"y-scale-end", y_scale_end,
NULL);
}
/**
* clutter_behaviour_scale_set_bounds:
* @scale: a #ClutterBehaviourScale
* @x_scale_start: initial scale factor on the X axis
* @y_scale_start: initial scale factor on the Y axis
* @x_scale_end: final scale factor on the X axis
* @y_scale_end: final scale factor on the Y axis
*
* Sets the bounds used by scale behaviour.
*
*
*
* Deprecated: 1.6
*/
void
clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
gdouble x_scale_start,
gdouble y_scale_start,
gdouble x_scale_end,
gdouble y_scale_end)
{
ClutterBehaviourScalePrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
priv = scale->priv;
g_object_freeze_notify (G_OBJECT (scale));
if (priv->x_scale_start != x_scale_start)
{
priv->x_scale_start = x_scale_start;
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_X_SCALE_START]);
}
if (priv->y_scale_start != y_scale_start)
{
priv->y_scale_start = y_scale_start;
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_Y_SCALE_START]);
}
if (priv->x_scale_end != x_scale_end)
{
priv->x_scale_end = x_scale_end;
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_X_SCALE_END]);
}
if (priv->y_scale_end != y_scale_end)
{
priv->y_scale_end = y_scale_end;
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_Y_SCALE_END]);
}
g_object_thaw_notify (G_OBJECT (scale));
}
/**
* clutter_behaviour_scale_get_bounds:
* @scale: a #ClutterBehaviourScale
* @x_scale_start: (out): return location for the initial scale factor on the X
* axis, or %NULL
* @y_scale_start: (out): return location for the initial scale factor on the Y
* axis, or %NULL
* @x_scale_end: (out): return location for the final scale factor on the X axis,
* or %NULL
* @y_scale_end: (out): return location for the final scale factor on the Y axis,
* or %NULL
*
* Retrieves the bounds used by scale behaviour.
*
*
*
* Deprecated: 1.6
*/
void
clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
gdouble *x_scale_start,
gdouble *y_scale_start,
gdouble *x_scale_end,
gdouble *y_scale_end)
{
ClutterBehaviourScalePrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
priv = scale->priv;
if (x_scale_start)
*x_scale_start = priv->x_scale_start;
if (x_scale_end)
*x_scale_end = priv->x_scale_end;
if (y_scale_start)
*y_scale_start = priv->y_scale_start;
if (y_scale_end)
*y_scale_end = priv->y_scale_end;
}

View file

@ -1,107 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_SCALE_H__
#define __CLUTTER_BEHAVIOUR_SCALE_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_SCALE (clutter_behaviour_scale_get_type ())
#define CLUTTER_BEHAVIOUR_SCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScale))
#define CLUTTER_BEHAVIOUR_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
#define CLUTTER_IS_BEHAVIOUR_SCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE))
#define CLUTTER_IS_BEHAVIOUR_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_SCALE))
#define CLUTTER_BEHAVIOUR_SCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
typedef struct _ClutterBehaviourScale ClutterBehaviourScale;
typedef struct _ClutterBehaviourScalePrivate ClutterBehaviourScalePrivate;
typedef struct _ClutterBehaviourScaleClass ClutterBehaviourScaleClass;
/**
* ClutterBehaviourScale:
*
* The #ClutterBehaviourScale struct contains only private data and
* should be accessed using the provided API
*
*
*
* Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:scale-x
* and #ClutterActor:scale-y instead.
*/
struct _ClutterBehaviourScale
{
/*< private >*/
ClutterBehaviour parent_instance;
ClutterBehaviourScalePrivate *priv;
};
/**
* ClutterBehaviourScaleClass:
*
* The #ClutterBehaviourScaleClass struct contains only private data
*
*
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourScaleClass
{
/*< private >*/
ClutterBehaviourClass parent_class;
};
CLUTTER_DEPRECATED_IN_1_6
GType clutter_behaviour_scale_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_6_FOR(clutter_actor_animate with ClutterActor:scale-x and ClutterActor:scale-y)
ClutterBehaviour *clutter_behaviour_scale_new (ClutterAlpha *alpha,
gdouble x_scale_start,
gdouble y_scale_start,
gdouble x_scale_end,
gdouble y_scale_end);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
gdouble x_scale_start,
gdouble y_scale_start,
gdouble x_scale_end,
gdouble y_scale_end);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
gdouble *x_scale_start,
gdouble *y_scale_start,
gdouble *x_scale_end,
gdouble *y_scale_end);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_SCALE_H__ */

View file

@ -1,669 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-behaviour
* @Title: ClutterBehaviour
* @short_description: Class for providing behaviours to actors
* @Deprecated: 1.6: Use clutter_actor_animate(), #ClutterAnimator or
* #ClutterState instead
*
* #ClutterBehaviour is the base class for implementing behaviours. A
* behaviour is a controller object for #ClutterActor<!-- -->s; you can
* use a behaviour to control one or more properties of an actor (such
* as its opacity, or its position). A #ClutterBehaviour is driven by
* an "alpha function" stored inside a #ClutterAlpha object; an alpha
* function is a function depending solely on time. The alpha function
* computes a value which is then applied to the properties of the
* actors driven by a behaviour.
*
* Clutter provides some pre-defined behaviours, like #ClutterBehaviourPath,
* which controls the position of a set of actors making them "walk" along
* a set of nodes; #ClutterBehaviourOpacity, which controls the opacity
* of a set of actors; #ClutterBehaviourScale, which controls the width
* and height of a set of actors.
*
* To visualize the effects of different alpha functions on a
* #ClutterBehaviour implementation it is possible to take the
* #ClutterBehaviourPath as an example:
*
* <figure id="behaviour-path-alpha">
* <title>Effects of alpha functions on a path</title>
* <graphic fileref="path-alpha-func.png" format="PNG"/>
* </figure>
*
* The actors position between the path's end points directly correlates
* to the #ClutterAlpha's current alpha value driving the behaviour. With
* the #ClutterAlpha's function set to a linear ramp the actor
* will follow the path at a constant velocity, but when changing to
* a sine wave the actor initially accelerates before quickly
* decelerating.
*
* In order to implement a new behaviour you should subclass #ClutterBehaviour
* and override the "alpha_notify" virtual function; inside the overridden
* function you should obtain the alpha value from the #ClutterAlpha
* instance bound to the behaviour and apply it to the desiderd property
* (or properties) of every actor controlled by the behaviour.
*
* #ClutterBehaviour is available since Clutter 0.2.
*
* #ClutterBehaviour and its sub-classes have been deprecated since Clutter
* 1.6. You should see <link linkend="migrating-ClutterBehaviour">the
* migration guide</link> for more information on migrating code from using
* the #ClutterBehaviour API to the animation framework API.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-behaviour.h"
#include "clutter-alpha.h"
#include "clutter-debug.h"
#include "clutter-main.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "clutter-scriptable.h"
#include "clutter-script-private.h"
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterBehaviour,
clutter_behaviour,
G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
clutter_scriptable_iface_init));
struct _ClutterBehaviourPrivate
{
ClutterAlpha *alpha;
guint notify_id;
GSList *actors;
};
enum
{
PROP_0,
PROP_ALPHA,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
enum {
APPLIED,
REMOVED,
LAST_SIGNAL
};
static guint behave_signals[LAST_SIGNAL] = { 0 };
#define CLUTTER_BEHAVIOUR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
CLUTTER_TYPE_BEHAVIOUR, \
ClutterBehaviourPrivate))
static gboolean
clutter_behaviour_parse_custom_node (ClutterScriptable *scriptable,
ClutterScript *script,
GValue *value,
const gchar *name,
JsonNode *node)
{
if (strncmp (name, "alpha", 5) == 0)
{
GObject *alpha;
alpha = _clutter_script_parse_alpha (script, node);
if (alpha != NULL)
{
g_value_init (value, CLUTTER_TYPE_ALPHA);
g_value_set_object (value, alpha);
return TRUE;
}
}
return FALSE;
}
static void
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
{
iface->parse_custom_node = clutter_behaviour_parse_custom_node;
}
static void
clutter_behaviour_dispose (GObject *gobject)
{
ClutterBehaviour *self = CLUTTER_BEHAVIOUR (gobject);
clutter_behaviour_set_alpha (self, NULL);
clutter_behaviour_remove_all (self);
G_OBJECT_CLASS (clutter_behaviour_parent_class)->dispose (gobject);
}
static void
clutter_behaviour_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviour *behaviour = CLUTTER_BEHAVIOUR (object);
switch (prop_id)
{
case PROP_ALPHA:
clutter_behaviour_set_alpha (behaviour, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviour *behaviour = CLUTTER_BEHAVIOUR (object);
ClutterBehaviourPrivate *priv = behaviour->priv;
switch (prop_id)
{
case PROP_ALPHA:
g_value_set_object (value, priv->alpha);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_alpha_notify_unimplemented (ClutterBehaviour *behaviour,
gdouble alpha_value)
{
g_warning ("ClutterBehaviourClass::alpha_notify not implemented for '%s'",
g_type_name (G_TYPE_FROM_INSTANCE (behaviour)));
}
static void
clutter_behaviour_class_init (ClutterBehaviourClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = clutter_behaviour_dispose;
object_class->set_property = clutter_behaviour_set_property;
object_class->get_property = clutter_behaviour_get_property;
/**
* ClutterBehaviour:alpha:
*
* The #ClutterAlpha object used to drive this behaviour. A #ClutterAlpha
* object binds a #ClutterTimeline and a function which computes a value
* (the "alpha") depending on the time. Each time the alpha value changes
* the alpha-notify virtual function is called.
*
*
*
* Deprecated: 1.6
*/
obj_props[PROP_ALPHA] =
g_param_spec_object ("alpha",
P_("Alpha"),
P_("Alpha Object to drive the behaviour"),
CLUTTER_TYPE_ALPHA,
CLUTTER_PARAM_READWRITE);
g_object_class_install_properties (object_class,
PROP_LAST,
obj_props);
klass->alpha_notify = clutter_behaviour_alpha_notify_unimplemented;
/**
* ClutterBehaviour::applied:
* @behaviour: the #ClutterBehaviour that received the signal
* @actor: the actor the behaviour was applied to.
*
* The ::apply signal is emitted each time the behaviour is applied
* to an actor.
*
*
*
* Deprecated: 1.6
*/
behave_signals[APPLIED] =
g_signal_new ("applied",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterBehaviourClass, applied),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
/**
* ClutterBehaviour::removed:
* @behaviour: the #ClutterBehaviour that received the signal
* @actor: the removed actor
*
* The ::removed signal is emitted each time a behaviour is not applied
* to an actor anymore.
*
*
*
* Deprecated: 1.6
*/
behave_signals[REMOVED] =
g_signal_new ("removed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterBehaviourClass, removed),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
g_type_class_add_private (klass, sizeof (ClutterBehaviourPrivate));
}
static void
clutter_behaviour_init (ClutterBehaviour *self)
{
self->priv = CLUTTER_BEHAVIOUR_GET_PRIVATE (self);
}
static void
remove_actor_on_destroy (ClutterActor *actor,
ClutterBehaviour *behaviour)
{
clutter_behaviour_remove (behaviour, actor);
}
/**
* clutter_behaviour_apply:
* @behave: a #ClutterBehaviour
* @actor: a #ClutterActor
*
* Applies @behave to @actor. This function adds a reference on
* the actor.
*
*
*
* Deprecated: 1.6
*/
void
clutter_behaviour_apply (ClutterBehaviour *behave,
ClutterActor *actor)
{
ClutterBehaviourPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
priv = behave->priv;
if (g_slist_find (priv->actors, actor))
{
g_warning ("The behaviour of type %s already applies "
"to the actor of type %s",
g_type_name (G_OBJECT_TYPE (behave)),
g_type_name (G_OBJECT_TYPE (actor)));
return;
}
priv->actors = g_slist_append (priv->actors, g_object_ref (actor));
g_signal_connect (actor, "destroy",
G_CALLBACK (remove_actor_on_destroy),
behave);
g_signal_emit (behave, behave_signals[APPLIED], 0, actor);
}
/**
* clutter_behaviour_is_applied:
* @behave: a #ClutterBehaviour
* @actor: a #ClutterActor
*
* Check if @behave applied to @actor.
*
* Return value: TRUE if actor has behaviour. FALSE otherwise.
*
*
*
* Deprecated: 1.6
*/
gboolean
clutter_behaviour_is_applied (ClutterBehaviour *behave,
ClutterActor *actor)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), FALSE);
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
return (g_slist_find (behave->priv->actors, actor) != NULL);
}
/**
* clutter_behaviour_remove:
* @behave: a #ClutterBehaviour
* @actor: a #ClutterActor
*
* Removes @actor from the list of #ClutterActor<!-- -->s to which
* @behave applies. This function removes a reference on the actor.
*
*
*
* Deprecated: 1.6
*/
void
clutter_behaviour_remove (ClutterBehaviour *behave,
ClutterActor *actor)
{
ClutterBehaviourPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
priv = behave->priv;
if (!g_slist_find (priv->actors, actor))
{
g_warning ("The behaviour of type %s is not applied "
"to the actor of type %s",
g_type_name (G_OBJECT_TYPE (behave)),
g_type_name (G_OBJECT_TYPE (actor)));
return;
}
g_signal_handlers_disconnect_by_func (actor,
G_CALLBACK (remove_actor_on_destroy),
behave);
priv->actors = g_slist_remove (priv->actors, actor);
g_signal_emit (behave, behave_signals[REMOVED], 0, actor);
g_object_unref (actor);
}
/**
* clutter_behaviour_get_n_actors:
* @behave: a #ClutterBehaviour
*
* Gets the number of actors this behaviour is applied too.
*
* Return value: The number of applied actors
*
*
*
* Deprecated: 1.6
*/
gint
clutter_behaviour_get_n_actors (ClutterBehaviour *behave)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), 0);
return g_slist_length (behave->priv->actors);
}
/**
* clutter_behaviour_get_nth_actor:
* @behave: a #ClutterBehaviour
* @index_: the index of an actor this behaviour is applied too.
*
* Gets an actor the behaviour was applied to referenced by index num.
*
* Return value: (transfer none): A Clutter actor or NULL if @index_ is invalid.
*
*
*
* Deprecated: 1.6
*/
ClutterActor *
clutter_behaviour_get_nth_actor (ClutterBehaviour *behave,
gint index_)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), NULL);
return g_slist_nth_data (behave->priv->actors, index_);
}
/**
* clutter_behaviour_actors_foreach:
* @behave: a #ClutterBehaviour
* @func: (scope call): a function called for each actor
* @data: optional data to be passed to the function, or %NULL
*
* Calls @func for every actor driven by @behave.
*
*
*
* Deprecated: 1.6
*/
void
clutter_behaviour_actors_foreach (ClutterBehaviour *behave,
ClutterBehaviourForeachFunc func,
gpointer data)
{
GSList *l;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
g_return_if_fail (func != NULL);
for (l = behave->priv->actors; l != NULL; l = l->next)
{
ClutterActor *actor = l->data;
g_assert (CLUTTER_IS_ACTOR (actor));
func (behave, actor, data);
}
}
/**
* clutter_behaviour_get_alpha:
* @behave: a #ClutterBehaviour
*
* Retrieves the #ClutterAlpha object bound to @behave.
*
* Return value: (transfer none): a #ClutterAlpha object, or %NULL if no alpha
* object has been bound to this behaviour.
*
*
*
* Deprecated: 1.6
*/
ClutterAlpha *
clutter_behaviour_get_alpha (ClutterBehaviour *behave)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), NULL);
return behave->priv->alpha;
}
static void
notify_cb (GObject *object,
GParamSpec *param_spec,
ClutterBehaviour *behave)
{
ClutterBehaviourClass *klass;
klass = CLUTTER_BEHAVIOUR_GET_CLASS (behave);
CLUTTER_NOTE (ANIMATION, "notify::alpha");
/* no actors, we can stop right here */
if (behave->priv->actors == NULL)
return;
if (klass->alpha_notify != NULL)
{
gdouble alpha_value = clutter_alpha_get_alpha (behave->priv->alpha);
CLUTTER_NOTE (ANIMATION, "calling %s::alpha_notify (%p, %.4f)",
g_type_name (G_TYPE_FROM_CLASS (klass)),
behave, alpha_value);
klass->alpha_notify (behave, alpha_value);
}
}
/**
* clutter_behaviour_set_alpha:
* @behave: a #ClutterBehaviour
* @alpha: a #ClutterAlpha or %NULL to unset a previously set alpha
*
* Binds @alpha to a #ClutterBehaviour. The #ClutterAlpha object
* is what makes a behaviour work: for each tick of the timeline
* used by #ClutterAlpha a new value of the alpha parameter is
* computed by the alpha function; the value should be used by
* the #ClutterBehaviour to update one or more properties of the
* actors to which the behaviour applies.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance.
*
*
*
* Deprecated: 1.6
*/
void
clutter_behaviour_set_alpha (ClutterBehaviour *behave,
ClutterAlpha *alpha)
{
ClutterBehaviourPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
g_return_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha));
priv = behave->priv;
if (priv->alpha == alpha)
return;
if (priv->notify_id)
{
CLUTTER_NOTE (ANIMATION, "removing previous notify-id (%d)",
priv->notify_id);
g_signal_handler_disconnect (priv->alpha, priv->notify_id);
priv->notify_id = 0;
}
if (priv->alpha != NULL)
{
CLUTTER_NOTE (ANIMATION, "removing previous alpha object");
g_object_unref (priv->alpha);
priv->alpha = NULL;
}
if (alpha != NULL)
{
priv->alpha = g_object_ref_sink (alpha);
priv->notify_id = g_signal_connect (priv->alpha, "notify::alpha",
G_CALLBACK(notify_cb),
behave);
CLUTTER_NOTE (ANIMATION, "setting new alpha object (%p, notify:%d)",
priv->alpha, priv->notify_id);
}
g_object_notify_by_pspec (G_OBJECT (behave), obj_props[PROP_ALPHA]);
}
/**
* clutter_behaviour_get_actors:
* @behave: a #ClutterBehaviour
*
* Retrieves all the actors to which @behave applies. It is not recommended
* for derived classes to use this in there alpha notify method but use
* #clutter_behaviour_actors_foreach as it avoids alot of needless allocations.
*
* Return value: (transfer container) (element-type Clutter.Actor): a list of
* actors. You should free the returned list with g_slist_free() when
* finished using it.
*
*
*
* Deprecated: 1.6
*/
GSList *
clutter_behaviour_get_actors (ClutterBehaviour *behave)
{
ClutterBehaviourPrivate *priv;
GSList *retval, *l;
g_return_val_if_fail (CLUTTER_BEHAVIOUR (behave), NULL);
priv = behave->priv;
retval = NULL;
for (l = priv->actors; l != NULL; l = l->next)
retval = g_slist_prepend (retval, l->data);
return g_slist_reverse (retval);
}
/**
* clutter_behaviour_remove_all:
* @behave: a #ClutterBehaviour
*
* Removes every actor from the list that @behave holds.
*
*
*
* Deprecated: 1.6
*/
void
clutter_behaviour_remove_all (ClutterBehaviour *behave)
{
ClutterBehaviourPrivate *priv;
GSList *l;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
priv = behave->priv;
for (l = priv->actors; l != NULL; l = l->next)
{
ClutterActor *actor = l->data;
g_signal_emit (behave, behave_signals[REMOVED], 0, actor);
g_signal_handlers_disconnect_by_func (actor,
G_CALLBACK (remove_actor_on_destroy),
behave);
g_object_unref (actor);
}
g_slist_free (priv->actors);
priv->actors = NULL;
}

View file

@ -1,170 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_H__
#define __CLUTTER_BEHAVIOUR_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR clutter_behaviour_get_type()
#define CLUTTER_BEHAVIOUR(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviour))
#define CLUTTER_BEHAVIOUR_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass))
#define CLUTTER_IS_BEHAVIOUR(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR))
#define CLUTTER_IS_BEHAVIOUR_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR))
#define CLUTTER_BEHAVIOUR_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass))
typedef struct _ClutterBehaviourPrivate ClutterBehaviourPrivate;
typedef struct _ClutterBehaviourClass ClutterBehaviourClass;
/**
* ClutterBehaviourForeachFunc:
* @behaviour: the #ClutterBehaviour
* @actor: an actor driven by @behaviour
* @data: (closure): optional data passed to the function
*
* This function is passed to clutter_behaviour_actors_foreach() and
* will be called for each actor driven by @behaviour.
*
*
*
* Deprecated: 1.6
*/
typedef void (*ClutterBehaviourForeachFunc) (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer data);
/**
* ClutterBehaviour:
*
* #ClutterBehaviour-struct contains only private data and should
* be accessed with the functions below.
*
*
*
* Deprecated: 1.6
*/
struct _ClutterBehaviour
{
/*< private >*/
GObject parent;
ClutterBehaviourPrivate *priv;
};
/**
* ClutterBehaviourClass:
* @alpha_notify: virtual function, called each time the #ClutterAlpha
* computes a new alpha value; the actors to which the behaviour applies
* should be changed in this function. Every subclass of #ClutterBehaviour
* must implement this virtual function
* @applied: signal class handler for the ClutterBehaviour::applied signal
* @removed: signal class handler for the ClutterBehaviour::removed signal
*
* Base class for behaviours.
*
*
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourClass
{
/*< private >*/
GObjectClass parent_class;
/*< public >*/
/* vfunc, not signal */
void (*alpha_notify) (ClutterBehaviour *behave,
gdouble alpha_value);
/* signals */
void (*applied) (ClutterBehaviour *behave,
ClutterActor *actor);
void (*removed) (ClutterBehaviour *behave,
ClutterActor *actor);
/*< private >*/
/* padding, for future expansion */
void (*_clutter_behaviour1) (void);
void (*_clutter_behaviour2) (void);
void (*_clutter_behaviour3) (void);
void (*_clutter_behaviour4) (void);
void (*_clutter_behaviour5) (void);
void (*_clutter_behaviour6) (void);
};
CLUTTER_DEPRECATED_IN_1_6
GType clutter_behaviour_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_apply (ClutterBehaviour *behave,
ClutterActor *actor);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_remove (ClutterBehaviour *behave,
ClutterActor *actor);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_remove_all (ClutterBehaviour *behave);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_actors_foreach (ClutterBehaviour *behave,
ClutterBehaviourForeachFunc func,
gpointer data);
CLUTTER_DEPRECATED_IN_1_6
gint clutter_behaviour_get_n_actors (ClutterBehaviour *behave);
CLUTTER_DEPRECATED_IN_1_6
ClutterActor *clutter_behaviour_get_nth_actor (ClutterBehaviour *behave,
gint index_);
CLUTTER_DEPRECATED_IN_1_6
GSList * clutter_behaviour_get_actors (ClutterBehaviour *behave);
CLUTTER_DEPRECATED_IN_1_6
ClutterAlpha *clutter_behaviour_get_alpha (ClutterBehaviour *behave);
CLUTTER_DEPRECATED_IN_1_6
void clutter_behaviour_set_alpha (ClutterBehaviour *behave,
ClutterAlpha *alpha);
CLUTTER_DEPRECATED_IN_1_6
gboolean clutter_behaviour_is_applied (ClutterBehaviour *behave,
ClutterActor *actor);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_H__ */

View file

@ -1,56 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BIN_LAYOUT_DEPRECATED_H__
#define __CLUTTER_BIN_LAYOUT_DEPRECATED_H__
#include <clutter/clutter-bin-layout.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_IN_1_12
void clutter_bin_layout_set_alignment (ClutterBinLayout *self,
ClutterActor *child,
ClutterBinAlignment x_align,
ClutterBinAlignment y_align);
CLUTTER_DEPRECATED_IN_1_12
void clutter_bin_layout_get_alignment (ClutterBinLayout *self,
ClutterActor *child,
ClutterBinAlignment *x_align,
ClutterBinAlignment *y_align);
CLUTTER_DEPRECATED_IN_1_12
void clutter_bin_layout_add (ClutterBinLayout *self,
ClutterActor *child,
ClutterBinAlignment x_align,
ClutterBinAlignment y_align);
G_END_DECLS
#endif /* __CLUTTER_BIN_LAYOUT_DEPRECATED_H__ */

View file

@ -1,737 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2009,2010 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
*/
/**
* SECTION:clutter-box
* @short_description: A Generic layout container
*
* #ClutterBox is a #ClutterActor sub-class implementing the #ClutterContainer
* interface. A Box delegates the whole size requisition and size allocation to
* a #ClutterLayoutManager instance.
*
* <example id="example-clutter-box">
* <title>Using ClutterBox</title>
* <para>The following code shows how to create a #ClutterBox with
* a #ClutterLayoutManager sub-class, and how to add children to
* it via clutter_box_pack().</para>
* <programlisting>
* ClutterActor *box;
* ClutterLayoutManager *layout;
*
* /&ast; Create the layout manager first &ast;/
* layout = clutter_box_layout_new ();
* clutter_box_layout_set_homogeneous (CLUTTER_BOX_LAYOUT (layout), TRUE);
* clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (layout), 12);
*
* /&ast; Then create the ClutterBox actor. The Box will take
* &ast; ownership of the ClutterLayoutManager instance by sinking
* &ast; its floating reference
* &ast;/
* box = clutter_box_new (layout);
*
* /&ast; Now add children to the Box using the variadic arguments
* &ast; function clutter_box_pack() to set layout properties
* &ast;/
* clutter_box_pack (CLUTTER_BOX (box), actor,
* "x-align", CLUTTER_BOX_ALIGNMENT_CENTER,
* "y-align", CLUTTER_BOX_ALIGNMENT_END,
* "expand", TRUE,
* NULL);
* </programlisting>
* </example>
*
* #ClutterBox<!-- -->'s clutter_box_pack() wraps the generic
* clutter_container_add_actor() function, but it also allows setting
* layout properties while adding the new child to the box.
*
* #ClutterBox is available since Clutter 1.2
*
* Deprecated: 1.10: Use #ClutterActor instead.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <glib-object.h>
#include <gobject/gvaluecollector.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-container.h"
#include "clutter-box.h"
#include "clutter-actor-private.h"
#include "clutter-color.h"
#include "clutter-debug.h"
#include "clutter-enum-types.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
#define CLUTTER_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_BOX, ClutterBoxPrivate))
struct _ClutterBoxPrivate
{
ClutterLayoutManager *manager;
guint changed_id;
};
enum
{
PROP_0,
PROP_COLOR,
PROP_COLOR_SET,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST] = { NULL, };
static const ClutterColor default_box_color = { 255, 255, 255, 255 };
G_DEFINE_TYPE (ClutterBox, clutter_box, CLUTTER_TYPE_ACTOR);
static inline void
clutter_box_set_color_internal (ClutterBox *box,
const ClutterColor *color)
{
clutter_actor_set_background_color (CLUTTER_ACTOR (box), color);
g_object_notify_by_pspec (G_OBJECT (box), obj_props[PROP_COLOR_SET]);
g_object_notify_by_pspec (G_OBJECT (box), obj_props[PROP_COLOR]);
}
static gboolean
clutter_box_real_get_paint_volume (ClutterActor *actor,
ClutterPaintVolume *volume)
{
gboolean retval = FALSE;
ClutterActorIter iter;
ClutterActor *child;
/* if we have a background color, and an allocation, then we need to
* set it as the base of our paint volume
*/
retval = clutter_paint_volume_set_from_allocation (volume, actor);
/* bail out early if we don't have any child */
if (clutter_actor_get_n_children (actor) == 0)
return retval;
retval = TRUE;
/* otherwise, union the paint volumes of our children, in case
* any one of them decides to paint outside the parent's allocation
*/
clutter_actor_iter_init (&iter, actor);
while (clutter_actor_iter_next (&iter, &child))
{
const ClutterPaintVolume *child_volume;
/* This gets the paint volume of the child transformed into the
* group's coordinate space... */
child_volume = clutter_actor_get_transformed_paint_volume (child, actor);
if (!child_volume)
return FALSE;
clutter_paint_volume_union (volume, child_volume);
}
return retval;
}
static void
clutter_box_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBox *self = CLUTTER_BOX (gobject);
switch (prop_id)
{
case PROP_COLOR:
clutter_box_set_color_internal (self, clutter_value_get_color (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_box_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
case PROP_COLOR:
{
ClutterColor color;
clutter_actor_get_background_color (CLUTTER_ACTOR (gobject),
&color);
clutter_value_set_color (value, &color);
}
break;
case PROP_COLOR_SET:
{
gboolean color_set;
g_object_get (gobject, "background-color-set", &color_set, NULL);
g_value_set_boolean (value, color_set);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_box_real_destroy (ClutterActor *actor)
{
ClutterActor *iter;
iter = clutter_actor_get_first_child (actor);
while (iter != NULL)
{
ClutterActor *next = clutter_actor_get_next_sibling (iter);
clutter_actor_destroy (iter);
iter = next;
}
}
static void
clutter_box_class_init (ClutterBoxClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
g_type_class_add_private (klass, sizeof (ClutterBoxPrivate));
actor_class->destroy = clutter_box_real_destroy;
actor_class->get_paint_volume = clutter_box_real_get_paint_volume;
gobject_class->set_property = clutter_box_set_property;
gobject_class->get_property = clutter_box_get_property;
/**
* ClutterBox:color:
*
* The color to be used to paint the background of the
* #ClutterBox. Setting this property will set the
* #ClutterBox:color-set property as a side effect
*
*
*/
obj_props[PROP_COLOR] =
clutter_param_spec_color ("color",
P_("Color"),
P_("The background color of the box"),
&default_box_color,
CLUTTER_PARAM_READWRITE);
/**
* ClutterBox:color-set:
*
* Whether the #ClutterBox:color property has been set
*
*
*/
obj_props[PROP_COLOR_SET] =
g_param_spec_boolean ("color-set",
P_("Color Set"),
P_("Whether the background color is set"),
FALSE,
CLUTTER_PARAM_READWRITE);
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
}
static void
clutter_box_init (ClutterBox *self)
{
self->priv = CLUTTER_BOX_GET_PRIVATE (self);
}
/**
* clutter_box_new:
* @manager: a #ClutterLayoutManager
*
* Creates a new #ClutterBox. The children of the box will be layed
* out by the passed @manager
*
* Return value: the newly created #ClutterBox actor
*
*
*
* Deprecated: 1.10: Use clutter_actor_new() instead.
*/
ClutterActor *
clutter_box_new (ClutterLayoutManager *manager)
{
g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), NULL);
return g_object_new (CLUTTER_TYPE_BOX,
"layout-manager", manager,
NULL);
}
/**
* clutter_box_set_layout_manager:
* @box: a #ClutterBox
* @manager: a #ClutterLayoutManager
*
* Sets the #ClutterLayoutManager for @box
*
* A #ClutterLayoutManager is a delegate object that controls the
* layout of the children of @box
*
*
*
* Deprecated: 1.10: Use clutter_actor_set_layout_manager() instead.
*/
void
clutter_box_set_layout_manager (ClutterBox *box,
ClutterLayoutManager *manager)
{
clutter_actor_set_layout_manager (CLUTTER_ACTOR (box), manager);
}
/**
* clutter_box_get_layout_manager:
* @box: a #ClutterBox
*
* Retrieves the #ClutterLayoutManager instance used by @box
*
* Return value: (transfer none): a #ClutterLayoutManager. The returned
* #ClutterLayoutManager is owned by the #ClutterBox and it should not
* be unreferenced
*
*
*
* Deprecated: 1.10: Use clutter_actor_get_layout_manager() instead.
*/
ClutterLayoutManager *
clutter_box_get_layout_manager (ClutterBox *box)
{
return clutter_actor_get_layout_manager (CLUTTER_ACTOR (box));
}
/**
* clutter_box_packv:
* @box: a #ClutterBox
* @actor: a #ClutterActor
* @n_properties: the number of properties to set
* @properties: (array length=n_properties) (element-type utf8): a vector
* containing the property names to set
* @values: (array length=n_properties): a vector containing the property
* values to set
*
* Vector-based variant of clutter_box_pack(), intended for language
* bindings to use
*
*
*
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
*/
void
clutter_box_packv (ClutterBox *box,
ClutterActor *actor,
guint n_properties,
const gchar * const properties[],
const GValue *values)
{
ClutterLayoutManager *manager;
ClutterContainer *container;
ClutterLayoutMeta *meta;
GObjectClass *klass;
gint i;
g_return_if_fail (CLUTTER_IS_BOX (box));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
container = CLUTTER_CONTAINER (box);
clutter_container_add_actor (container, actor);
manager = clutter_actor_get_layout_manager (CLUTTER_ACTOR (box));
if (manager == NULL)
return;
meta = clutter_layout_manager_get_child_meta (manager,
container,
actor);
if (meta == NULL)
return;
klass = G_OBJECT_GET_CLASS (meta);
for (i = 0; i < n_properties; i++)
{
const gchar *pname = properties[i];
GParamSpec *pspec;
pspec = g_object_class_find_property (klass, pname);
if (pspec == NULL)
{
g_warning ("%s: the layout property '%s' for managers "
"of type '%s' (meta type '%s') does not exist",
G_STRLOC,
pname,
G_OBJECT_TYPE_NAME (manager),
G_OBJECT_TYPE_NAME (meta));
break;
}
if (!(pspec->flags & G_PARAM_WRITABLE))
{
g_warning ("%s: the layout property '%s' for managers "
"of type '%s' (meta type '%s') is not writable",
G_STRLOC,
pspec->name,
G_OBJECT_TYPE_NAME (manager),
G_OBJECT_TYPE_NAME (meta));
break;
}
clutter_layout_manager_child_set_property (manager,
container, actor,
pname, &values[i]);
}
}
static inline void
clutter_box_set_property_valist (ClutterBox *box,
ClutterActor *actor,
const gchar *first_property,
va_list var_args)
{
ClutterContainer *container = CLUTTER_CONTAINER (box);
ClutterLayoutManager *manager;
ClutterLayoutMeta *meta;
GObjectClass *klass;
const gchar *pname;
manager = clutter_actor_get_layout_manager (CLUTTER_ACTOR (box));
if (manager == NULL)
return;
meta = clutter_layout_manager_get_child_meta (manager,
container,
actor);
if (meta == NULL)
return;
klass = G_OBJECT_GET_CLASS (meta);
pname = first_property;
while (pname)
{
GValue value = { 0, };
GParamSpec *pspec;
gchar *error;
pspec = g_object_class_find_property (klass, pname);
if (pspec == NULL)
{
g_warning ("%s: the layout property '%s' for managers "
"of type '%s' (meta type '%s') does not exist",
G_STRLOC,
pname,
G_OBJECT_TYPE_NAME (manager),
G_OBJECT_TYPE_NAME (meta));
break;
}
if (!(pspec->flags & G_PARAM_WRITABLE))
{
g_warning ("%s: the layout property '%s' for managers "
"of type '%s' (meta type '%s') is not writable",
G_STRLOC,
pspec->name,
G_OBJECT_TYPE_NAME (manager),
G_OBJECT_TYPE_NAME (meta));
break;
}
G_VALUE_COLLECT_INIT (&value, G_PARAM_SPEC_VALUE_TYPE (pspec),
var_args, 0,
&error);
if (error)
{
g_warning ("%s: %s", G_STRLOC, error);
g_free (error);
break;
}
clutter_layout_manager_child_set_property (manager,
container, actor,
pspec->name, &value);
g_value_unset (&value);
pname = va_arg (var_args, gchar*);
}
}
/**
* clutter_box_pack:
* @box: a #ClutterBox
* @actor: a #ClutterActor
* @first_property: the name of the first property to set, or %NULL
* @...: a list of property name and value pairs, terminated by %NULL
*
* Adds @actor to @box and sets layout properties at the same time,
* if the #ClutterLayoutManager used by @box has them
*
* This function is a wrapper around clutter_container_add_actor()
* and clutter_layout_manager_child_set()
*
* Language bindings should use the vector-based clutter_box_packv()
* variant instead
*
*
*
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
*/
void
clutter_box_pack (ClutterBox *box,
ClutterActor *actor,
const gchar *first_property,
...)
{
va_list var_args;
g_return_if_fail (CLUTTER_IS_BOX (box));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
clutter_container_add_actor (CLUTTER_CONTAINER (box), actor);
if (first_property == NULL || *first_property == '\0')
return;
va_start (var_args, first_property);
clutter_box_set_property_valist (box, actor, first_property, var_args);
va_end (var_args);
}
/**
* clutter_box_pack_after:
* @box: a #ClutterBox
* @actor: a #ClutterActor
* @sibling: (allow-none): a #ClutterActor or %NULL
* @first_property: the name of the first property to set, or %NULL
* @...: a list of property name and value pairs, terminated by %NULL
*
* Adds @actor to @box, placing it after @sibling, and sets layout
* properties at the same time, if the #ClutterLayoutManager used by
* @box supports them
*
* If @sibling is %NULL then @actor is placed at the end of the
* list of children, to be allocated and painted after every other child
*
* This function is a wrapper around clutter_container_add_actor(),
* clutter_container_raise_child() and clutter_layout_manager_child_set()
*
*
*
* Deprecated: 1.10: Use clutter_actor_insert_child_above() instead.
*/
void
clutter_box_pack_after (ClutterBox *box,
ClutterActor *actor,
ClutterActor *sibling,
const gchar *first_property,
...)
{
va_list var_args;
g_return_if_fail (CLUTTER_IS_BOX (box));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
clutter_container_add_actor (CLUTTER_CONTAINER (box), actor);
clutter_container_raise_child (CLUTTER_CONTAINER (box), actor, sibling);
if (first_property == NULL || *first_property == '\0')
return;
va_start (var_args, first_property);
clutter_box_set_property_valist (box, actor, first_property, var_args);
va_end (var_args);
}
/**
* clutter_box_pack_before:
* @box: a #ClutterBox
* @actor: a #ClutterActor
* @sibling: (allow-none): a #ClutterActor or %NULL
* @first_property: the name of the first property to set, or %NULL
* @...: a list of property name and value pairs, terminated by %NULL
*
* Adds @actor to @box, placing it before @sibling, and sets layout
* properties at the same time, if the #ClutterLayoutManager used by
* @box supports them
*
* If @sibling is %NULL then @actor is placed at the beginning of the
* list of children, to be allocated and painted below every other child
*
* This function is a wrapper around clutter_container_add_actor(),
* clutter_container_lower_child() and clutter_layout_manager_child_set()
*
*
*
* Deprecated: 1.10: Use clutter_actor_insert_child_below() instead.
*/
void
clutter_box_pack_before (ClutterBox *box,
ClutterActor *actor,
ClutterActor *sibling,
const gchar *first_property,
...)
{
va_list var_args;
g_return_if_fail (CLUTTER_IS_BOX (box));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
clutter_container_add_actor (CLUTTER_CONTAINER (box), actor);
clutter_container_lower_child (CLUTTER_CONTAINER (box), actor, sibling);
if (first_property == NULL || *first_property == '\0')
return;
va_start (var_args, first_property);
clutter_box_set_property_valist (box, actor, first_property, var_args);
va_end (var_args);
}
/**
* clutter_box_pack_at:
* @box: a #ClutterBox
* @actor: a #ClutterActor
* @position: the position to insert the @actor at
* @first_property: the name of the first property to set, or %NULL
* @...: a list of property name and value pairs, terminated by %NULL
*
* Adds @actor to @box, placing it at @position, and sets layout
* properties at the same time, if the #ClutterLayoutManager used by
* @box supports them
*
* If @position is a negative number, or is larger than the number of
* children of @box, the new child is added at the end of the list of
* children
*
*
*
* Deprecated: 1.10: Use clutter_actor_insert_child_at_index() instead.
*/
void
clutter_box_pack_at (ClutterBox *box,
ClutterActor *actor,
gint position,
const gchar *first_property,
...)
{
va_list var_args;
g_return_if_fail (CLUTTER_IS_BOX (box));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
clutter_actor_insert_child_at_index (CLUTTER_ACTOR (box),
actor,
position);
/* we need to explicitly call this, because we're not going through
* the default code paths provided by clutter_container_add()
*/
clutter_container_create_child_meta (CLUTTER_CONTAINER (box), actor);
g_signal_emit_by_name (box, "actor-added", actor);
if (first_property == NULL || *first_property == '\0')
return;
va_start (var_args, first_property);
clutter_box_set_property_valist (box, actor, first_property, var_args);
va_end (var_args);
}
/**
* clutter_box_set_color:
* @box: a #ClutterBox
* @color: (allow-none): the background color, or %NULL to unset
*
* Sets (or unsets) the background color for @box
*
*
*
* Deprecated: 1.10: Use clutter_actor_set_background_color() instead.
*/
void
clutter_box_set_color (ClutterBox *box,
const ClutterColor *color)
{
g_return_if_fail (CLUTTER_IS_BOX (box));
clutter_box_set_color_internal (box, color);
}
/**
* clutter_box_get_color:
* @box: a #ClutterBox
* @color: (out caller-allocates): return location for a #ClutterColor
*
* Retrieves the background color of @box
*
* If the #ClutterBox:color-set property is set to %FALSE the
* returned #ClutterColor is undefined
*
*
*
* Deprecated: 1.10: Use clutter_actor_get_background_color() instead.
*/
void
clutter_box_get_color (ClutterBox *box,
ClutterColor *color)
{
g_return_if_fail (CLUTTER_IS_BOX (box));
g_return_if_fail (color != NULL);
clutter_actor_get_background_color (CLUTTER_ACTOR (box), color);
}

View file

@ -1,143 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2009,2010 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BOX_H__
#define __CLUTTER_BOX_H__
#include <clutter/clutter-actor.h>
#include <clutter/clutter-container.h>
#include <clutter/clutter-layout-manager.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BOX (clutter_box_get_type ())
#define CLUTTER_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BOX, ClutterBox))
#define CLUTTER_IS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BOX))
#define CLUTTER_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BOX, ClutterBoxClass))
#define CLUTTER_IS_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BOX))
#define CLUTTER_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BOX, ClutterBoxClass))
typedef struct _ClutterBox ClutterBox;
typedef struct _ClutterBoxPrivate ClutterBoxPrivate;
typedef struct _ClutterBoxClass ClutterBoxClass;
/**
* ClutterBox:
*
* The #ClutterBox structure contains only private data and should
* be accessed using the provided API
*
*
*/
struct _ClutterBox
{
/*< private >*/
ClutterActor parent_instance;
ClutterBoxPrivate *priv;
};
/**
* ClutterBoxClass:
*
* The #ClutterBoxClass structure contains only private data
*
*
*/
struct _ClutterBoxClass
{
/*< private >*/
ClutterActorClass parent_class;
/* padding, for future expansion */
void (*clutter_padding_1) (void);
void (*clutter_padding_2) (void);
void (*clutter_padding_3) (void);
void (*clutter_padding_4) (void);
void (*clutter_padding_5) (void);
void (*clutter_padding_6) (void);
};
CLUTTER_DEPRECATED_IN_1_10
GType clutter_box_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_new)
ClutterActor * clutter_box_new (ClutterLayoutManager *manager);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_set_layout_manager)
void clutter_box_set_layout_manager (ClutterBox *box,
ClutterLayoutManager *manager);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_get_layout_manager)
ClutterLayoutManager *clutter_box_get_layout_manager (ClutterBox *box);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_set_background_color)
void clutter_box_set_color (ClutterBox *box,
const ClutterColor *color);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_get_background_color)
void clutter_box_get_color (ClutterBox *box,
ClutterColor *color);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_add_child)
void clutter_box_pack (ClutterBox *box,
ClutterActor *actor,
const gchar *first_property,
...);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_add_child)
void clutter_box_packv (ClutterBox *box,
ClutterActor *actor,
guint n_properties,
const gchar * const properties[],
const GValue *values);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_insert_child_above)
void clutter_box_pack_after (ClutterBox *box,
ClutterActor *actor,
ClutterActor *sibling,
const gchar *first_property,
...);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_insert_child_below)
void clutter_box_pack_before (ClutterBox *box,
ClutterActor *actor,
ClutterActor *sibling,
const gchar *first_property,
...);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_insert_child_at_index)
void clutter_box_pack_at (ClutterBox *box,
ClutterActor *actor,
gint position,
const gchar *first_property,
...);
G_END_DECLS
#endif /* __CLUTTER_BOX_H__ */

File diff suppressed because it is too large Load diff

View file

@ -1,139 +0,0 @@
/*
* Clutter
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By: Emmanuele Bassi <ebassi@linux.intel.com>
* Matthew Allum <mallum@o-hand.com>
* Chris Lord <chris@o-hand.com>
* Iain Holmes <iain@o-hand.com>
* Neil Roberts <neil@linux.intel.com>
*
* Copyright (C) 2008, 2009, 2010 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_CAIRO_TEXTURE_H__
#define __CLUTTER_CAIRO_TEXTURE_H__
#include <clutter/clutter-texture.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_CAIRO_TEXTURE (clutter_cairo_texture_get_type ())
#define CLUTTER_CAIRO_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CAIRO_TEXTURE, ClutterCairoTexture))
#define CLUTTER_CAIRO_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CAIRO_TEXTURE, ClutterCairoTextureClass))
#define CLUTTER_IS_CAIRO_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CAIRO_TEXTURE))
#define CLUTTER_IS_CAIRO_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CAIRO_TEXTURE))
#define CLUTTER_CAIRO_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CAIRO_TEXTURE, ClutterCairoTextureClass))
typedef struct _ClutterCairoTexture ClutterCairoTexture;
typedef struct _ClutterCairoTextureClass ClutterCairoTextureClass;
typedef struct _ClutterCairoTexturePrivate ClutterCairoTexturePrivate;
/**
* ClutterCairoTexture:
*
* The #ClutterCairoTexture struct contains only private data.
*
*
*
* Deprecated: 1.12: Use #ClutterCanvas instead
*/
struct _ClutterCairoTexture
{
/*< private >*/
ClutterTexture parent_instance;
ClutterCairoTexturePrivate *priv;
};
/**
* ClutterCairoTextureClass:
* @create_surface: class handler for the #ClutterCairoTexture::create-surface
* signal
* @draw: class handler for the #ClutterCairoTexture::draw signal
*
* The #ClutterCairoTextureClass struct contains only private data.
*
*
*
* Deprecated: 1.12: Use #ClutterCanvas instead
*/
struct _ClutterCairoTextureClass
{
/*< private >*/
ClutterTextureClass parent_class;
/*< public >*/
cairo_surface_t *(* create_surface) (ClutterCairoTexture *texture,
guint width,
guint height);
gboolean (* draw) (ClutterCairoTexture *texture,
cairo_t *cr);
/*< private >*/
void (*_clutter_cairo_3) (void);
void (*_clutter_cairo_4) (void);
};
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_canvas_get_type)
GType clutter_cairo_texture_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_canvas_new)
ClutterActor * clutter_cairo_texture_new (guint width,
guint height);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_canvas_set_size)
void clutter_cairo_texture_set_surface_size (ClutterCairoTexture *self,
guint width,
guint height);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_canvas_get_size)
void clutter_cairo_texture_get_surface_size (ClutterCairoTexture *self,
guint *width,
guint *height);
CLUTTER_DEPRECATED_IN_1_12
void clutter_cairo_texture_set_auto_resize (ClutterCairoTexture *self,
gboolean value);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_cairo_texture_get_auto_resize (ClutterCairoTexture *self);
CLUTTER_DEPRECATED_IN_1_12
void clutter_cairo_texture_clear (ClutterCairoTexture *self);
CLUTTER_DEPRECATED_IN_1_12
void clutter_cairo_texture_invalidate_rectangle (ClutterCairoTexture *self,
cairo_rectangle_int_t *rect);
CLUTTER_DEPRECATED_IN_1_12
void clutter_cairo_texture_invalidate (ClutterCairoTexture *self);
CLUTTER_DEPRECATED_IN_1_8_FOR(clutter_cairo_texture_invalidate_rectangle)
cairo_t * clutter_cairo_texture_create_region (ClutterCairoTexture *self,
gint x_offset,
gint y_offset,
gint width,
gint height);
CLUTTER_DEPRECATED_IN_1_8_FOR(clutter_cairo_texture_invalidate)
cairo_t * clutter_cairo_texture_create (ClutterCairoTexture *self);
G_END_DECLS
#endif /* __CLUTTER_CAIRO_TEXTURE_DEPRECATED_H__ */

View file

@ -1,93 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2011 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* ClutterContainer: Generic actor container interface.
*
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_CONTAINER_DEPRECATED_H__
#define __CLUTTER_CONTAINER_DEPRECATED_H__
#include <clutter/clutter-container.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_add_child)
void clutter_container_add (ClutterContainer *container,
ClutterActor *first_actor,
...) G_GNUC_NULL_TERMINATED;
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_add_child)
void clutter_container_add_actor (ClutterContainer *container,
ClutterActor *actor);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_add_child)
void clutter_container_add_valist (ClutterContainer *container,
ClutterActor *first_actor,
va_list var_args);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_remove_child)
void clutter_container_remove (ClutterContainer *container,
ClutterActor *first_actor,
...) G_GNUC_NULL_TERMINATED;
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_remove_child)
void clutter_container_remove_actor (ClutterContainer *container,
ClutterActor *actor);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_remove_child)
void clutter_container_remove_valist (ClutterContainer *container,
ClutterActor *first_actor,
va_list var_args);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_get_children)
GList * clutter_container_get_children (ClutterContainer *container);
CLUTTER_DEPRECATED_IN_1_10
void clutter_container_foreach (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data);
CLUTTER_DEPRECATED_IN_1_10
void clutter_container_foreach_with_internals (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_set_child_above_sibling)
void clutter_container_raise_child (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_set_child_below_sibling)
void clutter_container_lower_child (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling);
CLUTTER_DEPRECATED_IN_1_10
void clutter_container_sort_depth_order (ClutterContainer *container);
G_END_DECLS
#endif /* __CLUTTER_CONTAINER_DEPRECATED_H__ */

View file

@ -1,205 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Tomas Frydrych <tf@openedhand.com>
*
* Copyright (C) 2006, 2007 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
#define G_IMPLEMENT_INLINES
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
/* This file depends on the cogl-fixed api which isn't exposed when
* COGL_ENABLE_EXPERIMENTAL_2_0_API is defined...
*/
#undef COGL_ENABLE_EXPERIMENTAL_2_0_API
#include <cogl/cogl.h>
#include <glib-object.h>
#include "clutter-fixed.h"
#include "clutter-private.h"
/**
* clutter_value_set_fixed: (skip)
* @value: a #GValue initialized to %COGL_TYPE_FIXED
* @fixed_: the fixed point value to set
*
* Sets @value to @fixed_.
*
*
*
* Deprecated: 1.10: Use g_value_set_int() instead.
*/
void
clutter_value_set_fixed (GValue *value,
CoglFixed fixed_)
{
g_return_if_fail (CLUTTER_VALUE_HOLDS_FIXED (value));
value->data[0].v_int = fixed_;
}
/**
* clutter_value_get_fixed: (skip)
* @value: a #GValue initialized to %COGL_TYPE_FIXED
*
* Gets the fixed point value stored inside @value.
*
* Return value: the value inside the passed #GValue
*
*
*
* Deprecated: 1.10: Use g_value_get_int() instead.
*/
CoglFixed
clutter_value_get_fixed (const GValue *value)
{
g_return_val_if_fail (CLUTTER_VALUE_HOLDS_FIXED (value), 0);
return value->data[0].v_int;
}
static void
param_fixed_init (GParamSpec *pspec)
{
ClutterParamSpecFixed *fspec = CLUTTER_PARAM_SPEC_FIXED (pspec);
fspec->minimum = COGL_FIXED_MIN;
fspec->maximum = COGL_FIXED_MAX;
fspec->default_value = 0;
}
static void
param_fixed_set_default (GParamSpec *pspec,
GValue *value)
{
value->data[0].v_int = CLUTTER_PARAM_SPEC_FIXED (pspec)->default_value;
}
static gboolean
param_fixed_validate (GParamSpec *pspec,
GValue *value)
{
ClutterParamSpecFixed *fspec = CLUTTER_PARAM_SPEC_FIXED (pspec);
gint oval = value->data[0].v_int;
gint min, max, val;
g_assert (CLUTTER_IS_PARAM_SPEC_FIXED (pspec));
/* we compare the integer part of the value because the minimum
* and maximum values cover just that part of the representation
*/
min = fspec->minimum;
max = fspec->maximum;
val = (value->data[0].v_int);
val = CLAMP (val, min, max);
if (val != oval)
{
value->data[0].v_int = val;
return TRUE;
}
return FALSE;
}
static gint
param_fixed_values_cmp (GParamSpec *pspec,
const GValue *value1,
const GValue *value2)
{
if (value1->data[0].v_int < value2->data[0].v_int)
return -1;
else
return value1->data[0].v_int > value2->data[0].v_int;
}
GType
clutter_param_fixed_get_type (void)
{
static GType pspec_type = 0;
if (G_UNLIKELY (pspec_type == 0))
{
const GParamSpecTypeInfo pspec_info = {
sizeof (ClutterParamSpecFixed),
16,
param_fixed_init,
COGL_TYPE_FIXED,
NULL,
param_fixed_set_default,
param_fixed_validate,
param_fixed_values_cmp,
};
pspec_type = g_param_type_register_static (I_("ClutterParamSpecFixed"),
&pspec_info);
}
return pspec_type;
}
/**
* clutter_param_spec_fixed: (skip)
* @name: name of the property
* @nick: short name
* @blurb: description (can be translatable)
* @minimum: lower boundary
* @maximum: higher boundary
* @default_value: default value
* @flags: flags for the param spec
*
* Creates a #GParamSpec for properties using #CoglFixed values
*
* Return value: (transfer full): the newly created #GParamSpec
*
*
*
* Deprecated: 1.10: Use #GParamSpecInt instead.
*/
GParamSpec *
clutter_param_spec_fixed (const gchar *name,
const gchar *nick,
const gchar *blurb,
CoglFixed minimum,
CoglFixed maximum,
CoglFixed default_value,
GParamFlags flags)
{
ClutterParamSpecFixed *fspec;
g_return_val_if_fail (default_value >= minimum && default_value <= maximum,
NULL);
fspec = g_param_spec_internal (CLUTTER_TYPE_PARAM_FIXED,
name, nick, blurb,
flags);
fspec->minimum = minimum;
fspec->maximum = maximum;
fspec->default_value = default_value;
return G_PARAM_SPEC (fspec);
}

View file

@ -1,97 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Tomas Frydrych <tf@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_FIXED_H__
#define __CLUTTER_FIXED_H__
#include <cogl/cogl.h>
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_PARAM_FIXED (clutter_param_fixed_get_type ())
#define CLUTTER_PARAM_SPEC_FIXED(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), CLUTTER_TYPE_PARAM_FIXED, ClutterParamSpecFixed))
#define CLUTTER_IS_PARAM_SPEC_FIXED(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), CLUTTER_TYPE_PARAM_FIXED))
/**
* CLUTTER_VALUE_HOLDS_FIXED:
* @x: a #GValue
*
* Evaluates to %TRUE if @x holds a #CoglFixed .
*
*
*
* Deprecated: 1.10: Use %G_VALUE_HOLDS_INT instead
*/
#define CLUTTER_VALUE_HOLDS_FIXED(x) (G_VALUE_HOLDS ((x), COGL_TYPE_FIXED))
typedef struct _ClutterParamSpecFixed ClutterParamSpecFixed;
/**
* ClutterParamSpecFixed: (skip)
* @minimum: lower boundary
* @maximum: higher boundary
* @default_value: default value
*
* #GParamSpec subclass for fixed point based properties
*
*
*
* Deprecated: Use #GParamSpecInt instead
*/
struct _ClutterParamSpecFixed
{
/*< private >*/
GParamSpec parent_instance;
/*< public >*/
CoglFixed minimum;
CoglFixed maximum;
CoglFixed default_value;
};
GType clutter_param_fixed_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_10_FOR(g_value_set_int)
void clutter_value_set_fixed (GValue *value,
CoglFixed fixed_);
CLUTTER_DEPRECATED_IN_1_10_FOR(g_value_get_int)
CoglFixed clutter_value_get_fixed (const GValue *value);
CLUTTER_DEPRECATED_IN_1_10_FOR(g_param_spec_int)
GParamSpec * clutter_param_spec_fixed (const gchar *name,
const gchar *nick,
const gchar *blurb,
CoglFixed minimum,
CoglFixed maximum,
CoglFixed default_value,
GParamFlags flags);
G_END_DECLS
#endif /* __CLUTTER_FIXED_H__ */

View file

@ -1,267 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Neil Roberts <neil@linux.intel.com>
*
* Copyright (C) 2008 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-main.h"
#include "clutter-private.h"
#include "deprecated/clutter-frame-source.h"
#include "deprecated/clutter-timeout-interval.h"
typedef struct _ClutterFrameSource ClutterFrameSource;
struct _ClutterFrameSource
{
GSource source;
ClutterTimeoutInterval timeout;
};
static gboolean clutter_frame_source_prepare (GSource *source,
gint *timeout);
static gboolean clutter_frame_source_check (GSource *source);
static gboolean clutter_frame_source_dispatch (GSource *source,
GSourceFunc callback,
gpointer user_data);
static GSourceFuncs clutter_frame_source_funcs =
{
clutter_frame_source_prepare,
clutter_frame_source_check,
clutter_frame_source_dispatch,
NULL
};
/**
* clutter_frame_source_add_full:
* @priority: the priority of the frame source. Typically this will be in the
* range between %G_PRIORITY_DEFAULT and %G_PRIORITY_HIGH.
* @fps: the number of times per second to call the function
* @func: function to call
* @data: data to pass to the function
* @notify: function to call when the timeout source is removed
*
* Sets a function to be called at regular intervals with the given
* priority. The function is called repeatedly until it returns
* %FALSE, at which point the timeout is automatically destroyed and
* the function will not be called again. The @notify function is
* called when the timeout is destroyed. The first call to the
* function will be at the end of the first @interval.
*
* This function is similar to g_timeout_add_full() except that it
* will try to compensate for delays. For example, if @func takes half
* the interval time to execute then the function will be called again
* half the interval time after it finished. In contrast
* g_timeout_add_full() would not fire until a full interval after the
* function completes so the delay between calls would be 1.0 / @fps *
* 1.5. This function does not however try to invoke the function
* multiple times to catch up missing frames if @func takes more than
* @interval ms to execute.
*
* Rename to: clutter_frame_source_add
*
* Return value: the ID (greater than 0) of the event source.
*
*
*
* Deprecated: 1.6
*/
guint
clutter_frame_source_add_full (gint priority,
guint fps,
GSourceFunc func,
gpointer data,
GDestroyNotify notify)
{
guint ret;
GSource *source = g_source_new (&clutter_frame_source_funcs,
sizeof (ClutterFrameSource));
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
_clutter_timeout_interval_init (&frame_source->timeout, fps);
if (priority != G_PRIORITY_DEFAULT)
g_source_set_priority (source, priority);
g_source_set_name (source, "Clutter frame timeout");
g_source_set_callback (source, func, data, notify);
ret = g_source_attach (source, NULL);
g_source_unref (source);
return ret;
}
/**
* clutter_frame_source_add: (skip)
* @fps: the number of times per second to call the function
* @func: function to call
* @data: data to pass to the function
*
* Simple wrapper around clutter_frame_source_add_full().
*
* Return value: the ID (greater than 0) of the event source.
*
*
*
* Deprecated: 1.6
*/
guint
clutter_frame_source_add (guint fps,
GSourceFunc func,
gpointer data)
{
return clutter_frame_source_add_full (G_PRIORITY_DEFAULT,
fps, func, data, NULL);
}
static gboolean
clutter_frame_source_prepare (GSource *source,
gint *delay)
{
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
gint64 current_time;
#if GLIB_CHECK_VERSION (2, 27, 3)
current_time = g_source_get_time (source) / 1000;
#else
{
GTimeVal source_time;
g_source_get_current_time (source, &source_time);
current_time = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
}
#endif
return _clutter_timeout_interval_prepare (current_time,
&frame_source->timeout,
delay);
}
static gboolean
clutter_frame_source_check (GSource *source)
{
return clutter_frame_source_prepare (source, NULL);
}
static gboolean
clutter_frame_source_dispatch (GSource *source,
GSourceFunc callback,
gpointer user_data)
{
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
return _clutter_timeout_interval_dispatch (&frame_source->timeout,
callback, user_data);
}
/**
* clutter_threads_add_frame_source_full:
* @priority: the priority of the frame source. Typically this will be in the
* range between %G_PRIORITY_DEFAULT and %G_PRIORITY_HIGH.
* @fps: the number of times per second to call the function
* @func: function to call
* @data: data to pass to the function
* @notify: function to call when the timeout source is removed
*
* Sets a function to be called at regular intervals holding the Clutter
* threads lock, with the given priority. The function is called repeatedly
* until it returns %FALSE, at which point the timeout is automatically
* removed and the function will not be called again. The @notify function
* is called when the timeout is removed.
*
* This function is similar to clutter_threads_add_timeout_full()
* except that it will try to compensate for delays. For example, if
* @func takes half the interval time to execute then the function
* will be called again half the interval time after it finished. In
* contrast clutter_threads_add_timeout_full() would not fire until a
* full interval after the function completes so the delay between
* calls would be @interval * 1.5. This function does not however try
* to invoke the function multiple times to catch up missing frames if
* @func takes more than @interval ms to execute.
*
* See also clutter_threads_add_idle_full().
*
* Rename to: clutter_threads_add_frame_source
*
* Return value: the ID (greater than 0) of the event source.
*
*
*
* Deprecated: 1.6
*/
guint
clutter_threads_add_frame_source_full (gint priority,
guint fps,
GSourceFunc func,
gpointer data,
GDestroyNotify notify)
{
ClutterThreadsDispatch *dispatch;
g_return_val_if_fail (func != NULL, 0);
dispatch = g_slice_new (ClutterThreadsDispatch);
dispatch->func = func;
dispatch->data = data;
dispatch->notify = notify;
return clutter_frame_source_add_full (priority,
fps,
_clutter_threads_dispatch, dispatch,
_clutter_threads_dispatch_free);
}
/**
* clutter_threads_add_frame_source: (skip)
* @fps: the number of times per second to call the function
* @func: function to call
* @data: data to pass to the function
*
* Simple wrapper around clutter_threads_add_frame_source_full().
*
* Return value: the ID (greater than 0) of the event source.
*
*
*
* Deprecated: 1.6
*/
guint
clutter_threads_add_frame_source (guint fps,
GSourceFunc func,
gpointer data)
{
g_return_val_if_fail (func != NULL, 0);
return clutter_threads_add_frame_source_full (G_PRIORITY_DEFAULT,
fps,
func, data,
NULL);
}

View file

@ -1,49 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2008 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_FRAME_SOURCE_H__
#define __CLUTTER_FRAME_SOURCE_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_IN_1_6
guint clutter_frame_source_add (guint fps,
GSourceFunc func,
gpointer data);
CLUTTER_DEPRECATED_IN_1_6
guint clutter_frame_source_add_full (gint priority,
guint fps,
GSourceFunc func,
gpointer data,
GDestroyNotify notify);
G_END_DECLS
#endif /* __CLUTTER_FRAME_SOURCE_H__ */

View file

@ -1,564 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-group
* @short_description: A fixed layout container
*
* A #ClutterGroup is an Actor which contains multiple child actors positioned
* relative to the #ClutterGroup position. Other operations such as scaling,
* rotating and clipping of the group will apply to the child actors.
*
* A #ClutterGroup's size is defined by the size and position of its children;
* it will be the smallest non-negative size that covers the right and bottom
* edges of all of its children.
*
* Setting the size on a Group using #ClutterActor methods like
* clutter_actor_set_size() will override the natural size of the Group,
* however this will not affect the size of the children and they may still
* be painted outside of the allocation of the group. One way to constrain
* the visible area of a #ClutterGroup to a specified allocation is to
* explicitly set the size of the #ClutterGroup and then use the
* #ClutterActor:clip-to-allocation property.
*
* Deprecated: 1.10: Use #ClutterActor instead.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdarg.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-group.h"
#include "clutter-actor.h"
#include "clutter-actor-private.h"
#include "clutter-container.h"
#include "clutter-fixed-layout.h"
#include "clutter-main.h"
#include "clutter-debug.h"
#include "clutter-enum-types.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "cogl/cogl.h"
#define CLUTTER_GROUP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_GROUP, ClutterGroupPrivate))
struct _ClutterGroupPrivate
{
GList *children;
ClutterLayoutManager *layout;
};
static void clutter_container_iface_init (ClutterContainerIface *iface);
G_DEFINE_TYPE_WITH_CODE (ClutterGroup, clutter_group, CLUTTER_TYPE_ACTOR,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
clutter_container_iface_init));
static gint
sort_by_depth (gconstpointer a,
gconstpointer b)
{
gfloat depth_a = clutter_actor_get_depth (CLUTTER_ACTOR(a));
gfloat depth_b = clutter_actor_get_depth (CLUTTER_ACTOR(b));
if (depth_a < depth_b)
return -1;
if (depth_a > depth_b)
return 1;
return 0;
}
static void
clutter_group_real_add (ClutterContainer *container,
ClutterActor *actor)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv;
g_object_ref (actor);
priv->children = g_list_append (priv->children, actor);
clutter_actor_set_parent (actor, CLUTTER_ACTOR (container));
clutter_actor_queue_relayout (CLUTTER_ACTOR (container));
g_signal_emit_by_name (container, "actor-added", actor);
clutter_container_sort_depth_order (container);
g_object_unref (actor);
}
static void
clutter_group_real_actor_added (ClutterContainer *container,
ClutterActor *actor)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv;
/* XXX - children added using clutter_actor_add_child() will
* cause actor-added to be emitted without going through the
* add() virtual function.
*
* if we get an actor-added for a child that is not in our
* list of children already, then we go in compatibility
* mode.
*/
if (g_list_find (priv->children, actor) != NULL)
return;
priv->children = g_list_append (priv->children, actor);
clutter_container_sort_depth_order (container);
}
static void
clutter_group_real_remove (ClutterContainer *container,
ClutterActor *actor)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv;
g_object_ref (actor);
priv->children = g_list_remove (priv->children, actor);
clutter_actor_unparent (actor);
clutter_actor_queue_relayout (CLUTTER_ACTOR (container));
g_signal_emit_by_name (container, "actor-removed", actor);
clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
g_object_unref (actor);
}
static void
clutter_group_real_actor_removed (ClutterContainer *container,
ClutterActor *actor)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv;
/* XXX - same compatibility mode of the ::actor-added implementation */
if (g_list_find (priv->children, actor) == NULL)
return;
priv->children = g_list_remove (priv->children, actor);
}
static void
clutter_group_real_foreach (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv;
/* Using g_list_foreach instead of iterating the list manually
because it has better protection against the current node being
removed. This will happen for example if someone calls
clutter_container_foreach(container, clutter_actor_destroy) */
g_list_foreach (priv->children, (GFunc) callback, user_data);
}
static void
clutter_group_real_raise (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv;
priv->children = g_list_remove (priv->children, actor);
/* Raise at the top */
if (!sibling)
{
GList *last_item;
last_item = g_list_last (priv->children);
if (last_item)
sibling = last_item->data;
priv->children = g_list_append (priv->children, actor);
}
else
{
gint index_ = g_list_index (priv->children, sibling) + 1;
priv->children = g_list_insert (priv->children, actor, index_);
}
/* set Z ordering a value below, this will then call sort
* as values are equal ordering shouldn't change but Z
* values will be correct.
*
* FIXME: get rid of this crap; this is so utterly broken and wrong on
* so many levels it's not even funny. sadly, we get to keep this until
* we can break API and remove Group for good.
*/
if (sibling &&
clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor))
{
clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling));
}
clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
}
static void
clutter_group_real_lower (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling)
{
ClutterGroup *self = CLUTTER_GROUP (container);
ClutterGroupPrivate *priv = self->priv;
priv->children = g_list_remove (priv->children, actor);
/* Push to bottom */
if (!sibling)
{
GList *last_item;
last_item = g_list_first (priv->children);
if (last_item)
sibling = last_item->data;
priv->children = g_list_prepend (priv->children, actor);
}
else
{
gint index_ = g_list_index (priv->children, sibling);
priv->children = g_list_insert (priv->children, actor, index_);
}
/* See comment in group_raise for this */
if (sibling &&
clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor))
{
clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling));
}
clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
}
static void
clutter_group_real_sort_depth_order (ClutterContainer *container)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv;
priv->children = g_list_sort (priv->children, sort_by_depth);
clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
}
static void
clutter_container_iface_init (ClutterContainerIface *iface)
{
iface->add = clutter_group_real_add;
iface->actor_added = clutter_group_real_actor_added;
iface->remove = clutter_group_real_remove;
iface->actor_removed = clutter_group_real_actor_removed;
iface->foreach = clutter_group_real_foreach;
iface->raise = clutter_group_real_raise;
iface->lower = clutter_group_real_lower;
iface->sort_depth_order = clutter_group_real_sort_depth_order;
}
static void
clutter_group_real_paint (ClutterActor *actor)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
CLUTTER_NOTE (PAINT, "ClutterGroup paint enter '%s'",
_clutter_actor_get_debug_name (actor));
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, NULL);
CLUTTER_NOTE (PAINT, "ClutterGroup paint leave '%s'",
_clutter_actor_get_debug_name (actor));
}
static void
clutter_group_real_pick (ClutterActor *actor,
const ClutterColor *pick)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
/* Chain up so we get a bounding box pained (if we are reactive) */
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor, pick);
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, NULL);
}
static void
clutter_group_real_get_preferred_width (ClutterActor *actor,
gfloat for_height,
gfloat *min_width,
gfloat *natural_width)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
clutter_layout_manager_get_preferred_width (priv->layout,
CLUTTER_CONTAINER (actor),
for_height,
min_width, natural_width);
}
static void
clutter_group_real_get_preferred_height (ClutterActor *actor,
gfloat for_width,
gfloat *min_height,
gfloat *natural_height)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
clutter_layout_manager_get_preferred_height (priv->layout,
CLUTTER_CONTAINER (actor),
for_width,
min_height, natural_height);
}
static void
clutter_group_real_allocate (ClutterActor *actor,
const ClutterActorBox *allocation,
ClutterAllocationFlags flags)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
ClutterActorClass *klass;
klass = CLUTTER_ACTOR_CLASS (clutter_group_parent_class);
klass->allocate (actor, allocation, flags);
if (priv->children == NULL)
return;
clutter_layout_manager_allocate (priv->layout,
CLUTTER_CONTAINER (actor),
allocation, flags);
}
static void
clutter_group_dispose (GObject *object)
{
ClutterGroup *self = CLUTTER_GROUP (object);
ClutterGroupPrivate *priv = self->priv;
/* Note: we are careful to consider that destroying children could
* have the side-effect of destroying other children so
* priv->children may be modified during clutter_actor_destroy. */
while (priv->children != NULL)
{
ClutterActor *child = priv->children->data;
priv->children = g_list_delete_link (priv->children, priv->children);
clutter_actor_destroy (child);
}
if (priv->layout)
{
clutter_layout_manager_set_container (priv->layout, NULL);
g_object_unref (priv->layout);
priv->layout = NULL;
}
G_OBJECT_CLASS (clutter_group_parent_class)->dispose (object);
}
static void
clutter_group_real_show_all (ClutterActor *actor)
{
clutter_container_foreach (CLUTTER_CONTAINER (actor),
CLUTTER_CALLBACK (clutter_actor_show),
NULL);
clutter_actor_show (actor);
}
static void
clutter_group_real_hide_all (ClutterActor *actor)
{
clutter_actor_hide (actor);
clutter_container_foreach (CLUTTER_CONTAINER (actor),
CLUTTER_CALLBACK (clutter_actor_hide),
NULL);
}
static gboolean
clutter_group_real_get_paint_volume (ClutterActor *actor,
ClutterPaintVolume *volume)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
GList *l;
if (priv->children == NULL)
return TRUE;
for (l = priv->children; l != NULL; l = l->next)
{
ClutterActor *child = l->data;
const ClutterPaintVolume *child_volume;
/* This gets the paint volume of the child transformed into the
* group's coordinate space... */
child_volume = clutter_actor_get_transformed_paint_volume (child, actor);
if (!child_volume)
return FALSE;
clutter_paint_volume_union (volume, child_volume);
}
return TRUE;
}
static void
clutter_group_class_init (ClutterGroupClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
g_type_class_add_private (klass, sizeof (ClutterGroupPrivate));
actor_class->get_preferred_width = clutter_group_real_get_preferred_width;
actor_class->get_preferred_height = clutter_group_real_get_preferred_height;
actor_class->allocate = clutter_group_real_allocate;
actor_class->paint = clutter_group_real_paint;
actor_class->pick = clutter_group_real_pick;
actor_class->show_all = clutter_group_real_show_all;
actor_class->hide_all = clutter_group_real_hide_all;
actor_class->get_paint_volume = clutter_group_real_get_paint_volume;
gobject_class->dispose = clutter_group_dispose;
}
static void
clutter_group_init (ClutterGroup *self)
{
ClutterActor *actor = CLUTTER_ACTOR (self);
self->priv = CLUTTER_GROUP_GET_PRIVATE (self);
/* turn on some optimization
*
* XXX - these so-called "optimizations" are insane and should have never
* been used. they introduce some weird behaviour that breaks invariants
* and has to be explicitly worked around.
*
* this flag was set by the ClutterFixedLayout, but since that layout
* manager is now the default for ClutterActor, we set the flag explicitly
* here, to avoid breaking perfectly working actors overriding the
* allocate() virtual function.
*
* also, we keep this flag here so that it can die once we get rid of
* ClutterGroup.
*/
clutter_actor_set_flags (actor, CLUTTER_ACTOR_NO_LAYOUT);
self->priv->layout = clutter_fixed_layout_new ();
g_object_ref_sink (self->priv->layout);
clutter_actor_set_layout_manager (actor, self->priv->layout);
}
/**
* clutter_group_new:
*
* Create a new #ClutterGroup.
*
* Return value: the newly created #ClutterGroup actor
*
* Deprecated: 1.10: Use clutter_actor_new() instead.
*/
ClutterActor *
clutter_group_new (void)
{
return g_object_new (CLUTTER_TYPE_GROUP, NULL);
}
/**
* clutter_group_remove_all:
* @self: A #ClutterGroup
*
* Removes all children actors from the #ClutterGroup.
*
* Deprecated: 1.10: Use clutter_actor_remove_all_children() instead.
*/
void
clutter_group_remove_all (ClutterGroup *self)
{
g_return_if_fail (CLUTTER_IS_GROUP (self));
clutter_actor_remove_all_children (CLUTTER_ACTOR (self));
}
/**
* clutter_group_get_n_children:
* @self: A #ClutterGroup
*
* Gets the number of actors held in the group.
*
* Return value: The number of child actors held in the group.
*
*
*
* Deprecated: 1.10: Use clutter_actor_get_n_children() instead.
*/
gint
clutter_group_get_n_children (ClutterGroup *self)
{
g_return_val_if_fail (CLUTTER_IS_GROUP (self), 0);
return clutter_actor_get_n_children (CLUTTER_ACTOR (self));
}
/**
* clutter_group_get_nth_child:
* @self: A #ClutterGroup
* @index_: the position of the requested actor.
*
* Gets a groups child held at @index_ in stack.
*
* Return value: (transfer none): A Clutter actor, or %NULL if
* @index_ is invalid.
*
*
*
* Deprecated: 1.10: Use clutter_actor_get_child_at_index() instead.
*/
ClutterActor *
clutter_group_get_nth_child (ClutterGroup *self,
gint index_)
{
ClutterActor *actor;
g_return_val_if_fail (CLUTTER_IS_GROUP (self), NULL);
actor = CLUTTER_ACTOR (self);
g_return_val_if_fail (index_ <= clutter_actor_get_n_children (actor), NULL);
return clutter_actor_get_child_at_index (actor, index_);
}

View file

@ -1,62 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2011 Intel Corp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_GROUP_DEPRECATED_H__
#define __CLUTTER_GROUP_DEPRECATED_H__
#include <clutter/clutter-types.h>
#include <clutter/clutter-group.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_new)
ClutterActor * clutter_group_new (void);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_get_child_at_index)
ClutterActor * clutter_group_get_nth_child (ClutterGroup *self,
gint index_);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_get_n_children)
gint clutter_group_get_n_children (ClutterGroup *self);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_remove_all_children)
void clutter_group_remove_all (ClutterGroup *self);
#ifndef CLUTTER_DISABLE_DEPRECATED
/* for Mr. Mallum only */
#define clutter_group_add(group,actor) G_STMT_START { \
ClutterActor *_actor = (ClutterActor *) (actor); \
if (CLUTTER_IS_GROUP ((group)) && CLUTTER_IS_ACTOR ((_actor))) \
{ \
ClutterContainer *_container = (ClutterContainer *) (group); \
clutter_container_add_actor (_container, _actor); \
} } G_STMT_END
#endif /* CLUTTER_DISABLE_DEPRECATED */
G_END_DECLS
#endif /* __CLUTTER_GROUP_DEPRECATED_H__ */

View file

@ -1,38 +0,0 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <glib-object.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-device-manager-private.h"
#include "deprecated/clutter-input-device.h"
/**
* clutter_input_device_get_device_coords:
* @device: a #ClutterInputDevice of type %CLUTTER_POINTER_DEVICE
* @x: (out): return location for the X coordinate
* @y: (out): return location for the Y coordinate
*
* Retrieves the latest coordinates of the pointer of @device
*
*
*
* Deprecated: 1.12: Use clutter_input_device_get_coords() instead.
*/
void
clutter_input_device_get_device_coords (ClutterInputDevice *device,
gint *x,
gint *y)
{
ClutterPoint point;
clutter_input_device_get_coords (device, NULL, &point);
if (x)
*x = point.x;
if (y)
*y = point.y;
}

View file

@ -1,41 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright © 2009, 2010, 2011 Intel Corp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_INPUT_DEVICE_DEPRECATED_H__
#define __CLUTTER_INPUT_DEVICE_DEPRECATED_H__
#include <clutter/clutter-input-device.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_input_device_get_coords)
void clutter_input_device_get_device_coords (ClutterInputDevice *device,
gint *x,
gint *y);
G_END_DECLS
#endif /* __CLUTTER_INPUT_DEVICE_DEPRECATED_H__ */

File diff suppressed because it is too large Load diff

View file

@ -1,89 +0,0 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "clutter-layout-manager.h"
/**
* clutter_layout_manager_begin_animation:
* @manager: a #ClutterLayoutManager
* @duration: the duration of the animation, in milliseconds
* @mode: the easing mode of the animation
*
* Begins an animation of @duration milliseconds, using the provided
* easing @mode
*
* The easing mode can be specified either as a #ClutterAnimationMode
* or as a logical id returned by clutter_alpha_register_func()
*
* The result of this function depends on the @manager implementation
*
* Return value: (transfer none): The #ClutterAlpha created by the
* layout manager; the returned instance is owned by the layout
* manager and should not be unreferenced
*
*
*
* Deprecated: 1.12
*/
ClutterAlpha *
clutter_layout_manager_begin_animation (ClutterLayoutManager *manager,
guint duration,
gulong mode)
{
ClutterLayoutManagerClass *klass;
g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), NULL);
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
return klass->begin_animation (manager, duration, mode);
}
/**
* clutter_layout_manager_end_animation:
* @manager: a #ClutterLayoutManager
*
* Ends an animation started by clutter_layout_manager_begin_animation()
*
* The result of this call depends on the @manager implementation
*
*
*
* Deprecated: 1.12
*/
void
clutter_layout_manager_end_animation (ClutterLayoutManager *manager)
{
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager)->end_animation (manager);
}
/**
* clutter_layout_manager_get_animation_progress:
* @manager: a #ClutterLayoutManager
*
* Retrieves the progress of the animation, if one has been started by
* clutter_layout_manager_begin_animation()
*
* The returned value has the same semantics of the #ClutterAlpha:alpha
* value
*
* Return value: the progress of the animation
*
*
*
* Deprecated: 1.12
*/
gdouble
clutter_layout_manager_get_animation_progress (ClutterLayoutManager *manager)
{
ClutterLayoutManagerClass *klass;
g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), 1.0);
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
return klass->get_animation_progress (manager);
}

View file

@ -1,96 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2011 Intel Corp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_MAIN_DEPRECATED_H__
#define __CLUTTER_MAIN_DEPRECATED_H__
#include <clutter/clutter-types.h>
#include <clutter/clutter-input-device.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_IN_1_10
void clutter_threads_init (void);
CLUTTER_DEPRECATED_IN_1_12
void clutter_threads_enter (void);
CLUTTER_DEPRECATED_IN_1_12
void clutter_threads_leave (void);
CLUTTER_DEPRECATED_IN_1_6
guint clutter_threads_add_frame_source (guint fps,
GSourceFunc func,
gpointer data);
CLUTTER_DEPRECATED_IN_1_6
guint clutter_threads_add_frame_source_full (gint priority,
guint fps,
GSourceFunc func,
gpointer data,
GDestroyNotify notify);
CLUTTER_DEPRECATED_IN_1_8_FOR(clutter_stage_set_motion_events_enabled)
void clutter_set_motion_events_enabled (gboolean enable);
CLUTTER_DEPRECATED_IN_1_8_FOR(clutter_stage_get_motion_events_enabled)
gboolean clutter_get_motion_events_enabled (void);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_stage_ensure_redraw)
void clutter_redraw (ClutterStage *stage);
CLUTTER_DEPRECATED_IN_1_10_FOR(cogl_pango_font_map_clear_glyph_cache)
void clutter_clear_glyph_cache (void);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_backend_set_font_options)
void clutter_set_font_flags (ClutterFontFlags flags);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_backend_get_font_options)
ClutterFontFlags clutter_get_font_flags (void);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_device_manager_get_device)
ClutterInputDevice * clutter_get_input_device_for_id (gint id_);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_input_device_grab)
void clutter_grab_pointer_for_device (ClutterActor *actor,
gint id_);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_input_device_ungrab)
void clutter_ungrab_pointer_for_device (gint id_);
CLUTTER_DEPRECATED_IN_1_10
void clutter_set_default_frame_rate (guint frames_per_sec);
CLUTTER_DEPRECATED_IN_1_10
gulong clutter_get_timestamp (void);
CLUTTER_DEPRECATED_IN_1_10
gboolean clutter_get_debug_enabled (void);
CLUTTER_DEPRECATED_IN_1_10
gboolean clutter_get_show_fps (void);
G_END_DECLS
#endif /* __CLUTTER_MAIN_DEPRECATED_H__ */

View file

@ -1,665 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By: Matthew Allum <mallum@openedhand.com>
* Emmanuele Bassi <ebassi@linux.intel.com>
*
* Copyright (C) 2006 OpenedHand
* Copyright (C) 2009 Intel Corp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-media
* @short_description: An interface for controlling playback of media data
*
* #ClutterMedia is an interface for controlling playback of media sources.
*
* Clutter core does not provide an implementation of this interface, but
* other integration libraries like Clutter-GStreamer implement it to offer
* a uniform API for applications.
*
* #ClutterMedia is available since Clutter 0.2
*
* #ClutterMedia is deprecated since Clutter 1.12
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-debug.h"
#include "clutter-enum-types.h"
#include "clutter-marshal.h"
#include "clutter-media.h"
#include "clutter-main.h"
#include "clutter-private.h" /* for DBG */
enum
{
EOS_SIGNAL,
ERROR_SIGNAL, /* can't be called 'ERROR' otherwise it clashes with wingdi.h */
LAST_SIGNAL
};
static guint media_signals[LAST_SIGNAL] = { 0, };
typedef ClutterMediaIface ClutterMediaInterface;
G_DEFINE_INTERFACE (ClutterMedia, clutter_media, G_TYPE_OBJECT);
static void
clutter_media_default_init (ClutterMediaInterface *iface)
{
GParamSpec *pspec = NULL;
/**
* ClutterMedia:uri:
*
* The location of a media file, expressed as a valid URI.
*
*
*
* Deprecated: 1.12
*/
pspec = g_param_spec_string ("uri",
P_("URI"),
P_("URI of a media file"),
NULL,
CLUTTER_PARAM_READWRITE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:playing:
*
* Whether the #ClutterMedia actor is playing.
*
*
*
* Deprecated: 1.12
*/
pspec = g_param_spec_boolean ("playing",
P_("Playing"),
P_("Whether the actor is playing"),
FALSE,
CLUTTER_PARAM_READWRITE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:progress:
*
* The current progress of the playback, as a normalized
* value between 0.0 and 1.0.
*
*
*
* Deprecated: 1.12
*/
pspec = g_param_spec_double ("progress",
P_("Progress"),
P_("Current progress of the playback"),
0.0, 1.0, 0.0,
CLUTTER_PARAM_READWRITE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:subtitle-uri:
*
* The location of a subtitle file, expressed as a valid URI.
*
*
*
* Deprecated: 1.12
*/
pspec = g_param_spec_string ("subtitle-uri",
P_("Subtitle URI"),
P_("URI of a subtitle file"),
NULL,
CLUTTER_PARAM_READWRITE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:subtitle-font-name:
*
* The font used to display subtitles. The font description has to
* follow the same grammar as the one recognized by
* pango_font_description_from_string().
*
*
*
* Deprecated: 1.12
*/
pspec = g_param_spec_string ("subtitle-font-name",
P_("Subtitle Font Name"),
P_("The font used to display subtitles"),
NULL,
CLUTTER_PARAM_READWRITE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:audio-volume:
*
* The volume of the audio, as a normalized value between
* 0.0 and 1.0.
*
*
*
* Deprecated: 1.12
*/
pspec = g_param_spec_double ("audio-volume",
P_("Audio Volume"),
P_("The volume of the audio"),
0.0, 1.0, 0.5,
CLUTTER_PARAM_READWRITE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:can-seek:
*
* Whether the current stream is seekable.
*
*
*
* Deprecated: 1.12
*/
pspec = g_param_spec_boolean ("can-seek",
P_("Can Seek"),
P_("Whether the current stream is seekable"),
FALSE,
CLUTTER_PARAM_READABLE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:buffer-fill:
*
* The fill level of the buffer for the current stream,
* as a value between 0.0 and 1.0.
*
*
*
* Deprecated: 1.12
*/
pspec = g_param_spec_double ("buffer-fill",
P_("Buffer Fill"),
P_("The fill level of the buffer"),
0.0, 1.0, 0.0,
CLUTTER_PARAM_READABLE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:duration:
*
* The duration of the current stream, in seconds
*
*
*
* Deprecated: 1.12
*/
pspec = g_param_spec_double ("duration",
P_("Duration"),
P_("The duration of the stream, in seconds"),
0, G_MAXDOUBLE, 0,
CLUTTER_PARAM_READABLE);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia::eos:
* @media: the #ClutterMedia instance that received the signal
*
* The ::eos signal is emitted each time the media stream ends.
*
*
*
* Deprecated: 1.12
*/
media_signals[EOS_SIGNAL] =
g_signal_new (I_("eos"),
CLUTTER_TYPE_MEDIA,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterMediaIface, eos),
NULL, NULL,
_clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* ClutterMedia::error:
* @media: the #ClutterMedia instance that received the signal
* @error: the #GError
*
* The ::error signal is emitted each time an error occurred.
*
*
*
* Deprecated: 1.12
*/
media_signals[ERROR_SIGNAL] =
g_signal_new (I_("error"),
CLUTTER_TYPE_MEDIA,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterMediaIface, error),
NULL, NULL,
_clutter_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
G_TYPE_ERROR);
}
/**
* clutter_media_set_uri:
* @media: a #ClutterMedia
* @uri: the URI of the media stream
*
* Sets the URI of @media to @uri.
*
*
*
* Deprecated: 1.12
*/
void
clutter_media_set_uri (ClutterMedia *media,
const gchar *uri)
{
g_return_if_fail (CLUTTER_IS_MEDIA(media));
g_object_set (G_OBJECT (media), "uri", uri, NULL);
}
/**
* clutter_media_get_uri:
* @media: a #ClutterMedia
*
* Retrieves the URI from @media.
*
* Return value: the URI of the media stream. Use g_free()
* to free the returned string
*
*
*
* Deprecated: 1.12
*/
gchar *
clutter_media_get_uri (ClutterMedia *media)
{
gchar *retval = NULL;
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), NULL);
g_object_get (G_OBJECT (media), "uri", &retval, NULL);
return retval;
}
/**
* clutter_media_set_playing:
* @media: a #ClutterMedia
* @playing: %TRUE to start playing
*
* Starts or stops playing of @media.
* The implementation might be asynchronous, so the way to know whether
* the actual playing state of the @media is to use the #GObject::notify
* signal on the #ClutterMedia:playing property and then retrieve the
* current state with clutter_media_get_playing(). ClutterGstVideoTexture
* in clutter-gst is an example of such an asynchronous implementation.
*
*
*
* Deprecated: 1.12
*/
void
clutter_media_set_playing (ClutterMedia *media,
gboolean playing)
{
g_return_if_fail (CLUTTER_IS_MEDIA(media));
g_object_set (G_OBJECT (media), "playing", playing, NULL);
}
/**
* clutter_media_get_playing:
* @media: A #ClutterMedia object
*
* Retrieves the playing status of @media.
*
* Return value: %TRUE if playing, %FALSE if stopped.
*
*
*
* Deprecated: 1.12
*/
gboolean
clutter_media_get_playing (ClutterMedia *media)
{
gboolean is_playing = FALSE;
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), FALSE);
g_object_get (G_OBJECT (media), "playing", &is_playing, NULL);
return is_playing;
}
/**
* clutter_media_set_progress:
* @media: a #ClutterMedia
* @progress: the progress of the playback, between 0.0 and 1.0
*
* Sets the playback progress of @media. The @progress is
* a normalized value between 0.0 (begin) and 1.0 (end).
*
*
*
* Deprecated: 1.12
*/
void
clutter_media_set_progress (ClutterMedia *media,
gdouble progress)
{
g_return_if_fail (CLUTTER_IS_MEDIA (media));
g_object_set (G_OBJECT (media), "progress", progress, NULL);
}
/**
* clutter_media_get_progress:
* @media: a #ClutterMedia
*
* Retrieves the playback progress of @media.
*
* Return value: the playback progress, between 0.0 and 1.0
*
*
*
* Deprecated: 1.12
*/
gdouble
clutter_media_get_progress (ClutterMedia *media)
{
gdouble retval = 0.0;
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), 0);
g_object_get (G_OBJECT (media), "progress", &retval, NULL);
return retval;
}
/**
* clutter_media_set_subtitle_uri:
* @media: a #ClutterMedia
* @uri: the URI of a subtitle file
*
* Sets the location of a subtitle file to display while playing @media.
*
*
*
* Deprecated: 1.12
*/
void
clutter_media_set_subtitle_uri (ClutterMedia *media,
const char *uri)
{
g_return_if_fail (CLUTTER_IS_MEDIA (media));
g_object_set (G_OBJECT (media), "subtitle-uri", uri, NULL);
}
/**
* clutter_media_get_subtitle_uri:
* @media: a #ClutterMedia
*
* Retrieves the URI of the subtitle file in use.
*
* Return value: the URI of the subtitle file. Use g_free()
* to free the returned string
*
*
*
* Deprecated: 1.12
*/
gchar *
clutter_media_get_subtitle_uri (ClutterMedia *media)
{
gchar *retval = NULL;
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), NULL);
g_object_get (G_OBJECT (media), "subtitle-uri", &retval, NULL);
return retval;
}
/**
* clutter_media_set_subtitle_font_name:
* @media: a #ClutterMedia
* @font_name: a font name, or %NULL to set the default font name
*
* Sets the font used by the subtitle renderer. The @font_name string must be
* either %NULL, which means that the default font name of the underlying
* implementation will be used; or must follow the grammar recognized by
* pango_font_description_from_string() like:
*
* |[
* clutter_media_set_subtitle_font_name (media, "Sans 24pt");
* ]|
*
*
*
* Deprecated: 1.12
*/
void
clutter_media_set_subtitle_font_name (ClutterMedia *media,
const char *font_name)
{
g_return_if_fail (CLUTTER_IS_MEDIA (media));
g_object_set (G_OBJECT (media), "subtitle-font-name", font_name, NULL);
}
/**
* clutter_media_get_subtitle_font_name:
* @media: a #ClutterMedia
*
* Retrieves the font name currently used.
*
* Return value: a string containing the font name. Use g_free()
* to free the returned string
*
*
*
* Deprecated: 1.12
*/
gchar *
clutter_media_get_subtitle_font_name (ClutterMedia *media)
{
gchar *retval = NULL;
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), NULL);
g_object_get (G_OBJECT (media), "subtitle-font-name", &retval, NULL);
return retval;
}
/**
* clutter_media_set_audio_volume:
* @media: a #ClutterMedia
* @volume: the volume as a double between 0.0 and 1.0
*
* Sets the playback volume of @media to @volume.
*
*
*
* Deprecated: 1.12
*/
void
clutter_media_set_audio_volume (ClutterMedia *media,
gdouble volume)
{
g_return_if_fail (CLUTTER_IS_MEDIA(media));
g_object_set (G_OBJECT (media), "audio-volume", volume, NULL);
}
/**
* clutter_media_get_audio_volume:
* @media: a #ClutterMedia
*
* Retrieves the playback volume of @media.
*
* Return value: The playback volume between 0.0 and 1.0
*
*
*
* Deprecated: 1.12
*/
gdouble
clutter_media_get_audio_volume (ClutterMedia *media)
{
gdouble retval = 0.0;
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), 0.0);
g_object_get (G_OBJECT (media), "audio-volume", &retval, NULL);
return retval;
}
/**
* clutter_media_get_can_seek:
* @media: a #ClutterMedia
*
* Retrieves whether @media is seekable or not.
*
* Return value: %TRUE if @media can seek, %FALSE otherwise.
*
*
*
* Deprecated: 1.12
*/
gboolean
clutter_media_get_can_seek (ClutterMedia *media)
{
gboolean retval = FALSE;
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), FALSE);
g_object_get (G_OBJECT (media), "can-seek", &retval, NULL);
return retval;
}
/**
* clutter_media_get_buffer_fill:
* @media: a #ClutterMedia
*
* Retrieves the amount of the stream that is buffered.
*
* Return value: the fill level, between 0.0 and 1.0
*
*
*
* Deprecated: 1.12
*/
gdouble
clutter_media_get_buffer_fill (ClutterMedia *media)
{
gdouble retval = 0.0;
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), 0);
g_object_get (G_OBJECT (media), "buffer-fill", &retval, NULL);
return retval;
}
/**
* clutter_media_get_duration:
* @media: a #ClutterMedia
*
* Retrieves the duration of the media stream that @media represents.
*
* Return value: the duration of the media stream, in seconds
*
*
*
* Deprecated: 1.12
*/
gdouble
clutter_media_get_duration (ClutterMedia *media)
{
gdouble retval = 0;
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), 0);
g_object_get (G_OBJECT (media), "duration", &retval, NULL);
return retval;
}
/* helper funcs */
/**
* clutter_media_set_filename:
* @media: a #ClutterMedia
* @filename: A filename
*
* Sets the source of @media using a file path.
*
*
*
* Deprecated: 1.12
*/
void
clutter_media_set_filename (ClutterMedia *media,
const gchar *filename)
{
gchar *uri;
GError *uri_error = NULL;
if (!g_path_is_absolute (filename))
{
gchar *abs_path;
abs_path = g_build_filename (g_get_current_dir (), filename, NULL);
uri = g_filename_to_uri (abs_path, NULL, &uri_error);
g_free (abs_path);
}
else
uri = g_filename_to_uri (filename, NULL, &uri_error);
if (uri_error)
{
g_signal_emit (media, media_signals[ERROR_SIGNAL], 0, uri_error);
g_error_free (uri_error);
return;
}
clutter_media_set_uri (media, uri);
g_free (uri);
}

View file

@ -1,121 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By: Matthew Allum <mallum@openedhand.com>
* Emmanuele Bassi <ebassi@linux.intel.com>
*
* Copyright (C) 2006 OpenedHand
* Copyright (C) 2009 Intel Corp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_MEDIA_H__
#define __CLUTTER_MEDIA_H__
#include <glib-object.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_MEDIA (clutter_media_get_type ())
#define CLUTTER_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_MEDIA, ClutterMedia))
#define CLUTTER_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_MEDIA))
#define CLUTTER_MEDIA_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_MEDIA, ClutterMediaIface))
typedef struct _ClutterMedia ClutterMedia; /* dummy typedef */
typedef struct _ClutterMediaIface ClutterMediaIface;
/**
* ClutterMedia:
*
* #ClutterMedia is an opaque structure whose members cannot be directly
* accessed
*
*
*/
/**
* ClutterMediaIface:
* @eos: handler for the #ClutterMedia::eos signal
* @error: handler for the #ClutterMedia::error signal
*
* Interface vtable for #ClutterMedia implementations
*
*
*/
struct _ClutterMediaIface
{
/*< private >*/
GTypeInterface base_iface;
/*< public >*/
/* signals */
void (* eos) (ClutterMedia *media);
void (* error) (ClutterMedia *media,
const GError *error);
};
CLUTTER_DEPRECATED_IN_1_12
GType clutter_media_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_12
void clutter_media_set_uri (ClutterMedia *media,
const gchar *uri);
CLUTTER_DEPRECATED_IN_1_12
gchar * clutter_media_get_uri (ClutterMedia *media);
CLUTTER_DEPRECATED_IN_1_12
void clutter_media_set_filename (ClutterMedia *media,
const gchar *filename);
CLUTTER_DEPRECATED_IN_1_12
void clutter_media_set_playing (ClutterMedia *media,
gboolean playing);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_media_get_playing (ClutterMedia *media);
CLUTTER_DEPRECATED_IN_1_12
void clutter_media_set_progress (ClutterMedia *media,
gdouble progress);
CLUTTER_DEPRECATED_IN_1_12
gdouble clutter_media_get_progress (ClutterMedia *media);
CLUTTER_DEPRECATED_IN_1_12
void clutter_media_set_subtitle_uri (ClutterMedia *media,
const gchar *uri);
CLUTTER_DEPRECATED_IN_1_12
gchar * clutter_media_get_subtitle_uri (ClutterMedia *media);
CLUTTER_DEPRECATED_IN_1_12
void clutter_media_set_subtitle_font_name (ClutterMedia *media,
const char *font_name);
CLUTTER_DEPRECATED_IN_1_12
gchar * clutter_media_get_subtitle_font_name (ClutterMedia *media);
CLUTTER_DEPRECATED_IN_1_12
void clutter_media_set_audio_volume (ClutterMedia *media,
gdouble volume);
CLUTTER_DEPRECATED_IN_1_12
gdouble clutter_media_get_audio_volume (ClutterMedia *media);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_media_get_can_seek (ClutterMedia *media);
CLUTTER_DEPRECATED_IN_1_12
gdouble clutter_media_get_buffer_fill (ClutterMedia *media);
CLUTTER_DEPRECATED_IN_1_12
gdouble clutter_media_get_duration (ClutterMedia *media);
G_END_DECLS
#endif /* __CLUTTER_MEDIA_H__ */

View file

@ -1,559 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
/**
* SECTION:clutter-rectangle
* @short_description: An actor that displays a simple rectangle.
*
* #ClutterRectangle is a #ClutterActor which draws a simple filled rectangle.
*
* Deprecated: 1.10: Use #ClutterActor instead.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-rectangle.h"
#include "deprecated/clutter-actor.h"
#include "clutter-actor-private.h"
#include "clutter-color.h"
#include "clutter-debug.h"
#include "clutter-main.h"
#include "clutter-private.h"
#include "cogl/cogl.h"
G_DEFINE_TYPE (ClutterRectangle, clutter_rectangle, CLUTTER_TYPE_ACTOR);
enum
{
PROP_0,
PROP_COLOR,
PROP_BORDER_COLOR,
PROP_BORDER_WIDTH,
PROP_HAS_BORDER
/* FIXME: Add gradient, rounded corner props etc */
};
#define CLUTTER_RECTANGLE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_RECTANGLE, ClutterRectanglePrivate))
struct _ClutterRectanglePrivate
{
ClutterColor color;
ClutterColor border_color;
guint border_width;
guint has_border : 1;
};
static const ClutterColor default_color = { 255, 255, 255, 255 };
static const ClutterColor default_border_color = { 0, 0, 0, 255 };
static void
clutter_rectangle_paint (ClutterActor *self)
{
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE (self)->priv;
ClutterGeometry geom;
guint8 tmp_alpha;
CLUTTER_NOTE (PAINT,
"painting rect '%s'",
clutter_actor_get_name (self) ? clutter_actor_get_name (self)
: "unknown");
clutter_actor_get_allocation_geometry (self, &geom);
/* parent paint call will have translated us into position so
* paint from 0, 0
*/
if (priv->has_border)
{
/* compute the composited opacity of the actor taking into
* account the opacity of the color set by the user
*/
tmp_alpha = clutter_actor_get_paint_opacity (self)
* priv->border_color.alpha
/ 255;
/* paint the border */
cogl_set_source_color4ub (priv->border_color.red,
priv->border_color.green,
priv->border_color.blue,
tmp_alpha);
/* this sucks, but it's the only way to make a border */
cogl_rectangle (priv->border_width, 0,
geom.width,
priv->border_width);
cogl_rectangle (geom.width - priv->border_width,
priv->border_width,
geom.width,
geom.height);
cogl_rectangle (0, geom.height - priv->border_width,
geom.width - priv->border_width,
geom.height);
cogl_rectangle (0, 0,
priv->border_width,
geom.height - priv->border_width);
tmp_alpha = clutter_actor_get_paint_opacity (self)
* priv->color.alpha
/ 255;
/* now paint the rectangle */
cogl_set_source_color4ub (priv->color.red,
priv->color.green,
priv->color.blue,
tmp_alpha);
cogl_rectangle (priv->border_width, priv->border_width,
geom.width - priv->border_width,
geom.height - priv->border_width);
}
else
{
/* compute the composited opacity of the actor taking into
* account the opacity of the color set by the user
*/
tmp_alpha = clutter_actor_get_paint_opacity (self)
* priv->color.alpha
/ 255;
cogl_set_source_color4ub (priv->color.red,
priv->color.green,
priv->color.blue,
tmp_alpha);
cogl_rectangle (0, 0, geom.width, geom.height);
}
}
static gboolean
clutter_rectangle_get_paint_volume (ClutterActor *self,
ClutterPaintVolume *volume)
{
return _clutter_actor_set_default_paint_volume (self,
CLUTTER_TYPE_RECTANGLE,
volume);
}
static gboolean
clutter_rectangle_has_overlaps (ClutterActor *self)
{
/* Rectangles never need an offscreen redirect because there are
never any overlapping primitives */
return FALSE;
}
static void
clutter_rectangle_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterRectangle *rectangle = CLUTTER_RECTANGLE(object);
switch (prop_id)
{
case PROP_COLOR:
clutter_rectangle_set_color (rectangle, clutter_value_get_color (value));
break;
case PROP_BORDER_COLOR:
clutter_rectangle_set_border_color (rectangle,
clutter_value_get_color (value));
break;
case PROP_BORDER_WIDTH:
clutter_rectangle_set_border_width (rectangle,
g_value_get_uint (value));
break;
case PROP_HAS_BORDER:
rectangle->priv->has_border = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_rectangle_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE(object)->priv;
switch (prop_id)
{
case PROP_COLOR:
clutter_value_set_color (value, &priv->color);
break;
case PROP_BORDER_COLOR:
clutter_value_set_color (value, &priv->border_color);
break;
case PROP_BORDER_WIDTH:
g_value_set_uint (value, priv->border_width);
break;
case PROP_HAS_BORDER:
g_value_set_boolean (value, priv->has_border);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_rectangle_finalize (GObject *object)
{
G_OBJECT_CLASS (clutter_rectangle_parent_class)->finalize (object);
}
static void
clutter_rectangle_dispose (GObject *object)
{
G_OBJECT_CLASS (clutter_rectangle_parent_class)->dispose (object);
}
static void
clutter_rectangle_class_init (ClutterRectangleClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GParamSpec *pspec;
actor_class->paint = clutter_rectangle_paint;
actor_class->get_paint_volume = clutter_rectangle_get_paint_volume;
actor_class->has_overlaps = clutter_rectangle_has_overlaps;
gobject_class->finalize = clutter_rectangle_finalize;
gobject_class->dispose = clutter_rectangle_dispose;
gobject_class->set_property = clutter_rectangle_set_property;
gobject_class->get_property = clutter_rectangle_get_property;
/**
* ClutterRectangle:color:
*
* The color of the rectangle.
*/
pspec = clutter_param_spec_color ("color",
P_("Color"),
P_("The color of the rectangle"),
&default_color,
CLUTTER_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_COLOR, pspec);
/**
* ClutterRectangle:border-color:
*
* The color of the border of the rectangle.
*
*
*/
pspec = clutter_param_spec_color ("border-color",
P_("Border Color"),
P_("The color of the border of the rectangle"),
&default_border_color,
CLUTTER_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_BORDER_COLOR, pspec);
/**
* ClutterRectangle:border-width:
*
* The width of the border of the rectangle, in pixels.
*
*
*/
g_object_class_install_property (gobject_class,
PROP_BORDER_WIDTH,
g_param_spec_uint ("border-width",
P_("Border Width"),
P_("The width of the border of the rectangle"),
0, G_MAXUINT,
0,
CLUTTER_PARAM_READWRITE));
/**
* ClutterRectangle:has-border:
*
* Whether the #ClutterRectangle should be displayed with a border.
*
*
*/
g_object_class_install_property (gobject_class,
PROP_HAS_BORDER,
g_param_spec_boolean ("has-border",
P_("Has Border"),
P_("Whether the rectangle should have a border"),
FALSE,
CLUTTER_PARAM_READWRITE));
g_type_class_add_private (gobject_class, sizeof (ClutterRectanglePrivate));
}
static void
clutter_rectangle_init (ClutterRectangle *self)
{
ClutterRectanglePrivate *priv;
self->priv = priv = CLUTTER_RECTANGLE_GET_PRIVATE (self);
priv->color = default_color;
priv->border_color = default_border_color;
priv->border_width = 0;
priv->has_border = FALSE;
}
/**
* clutter_rectangle_new:
*
* Creates a new #ClutterActor with a rectangular shape.
*
* Return value: a new #ClutterActor
*/
ClutterActor*
clutter_rectangle_new (void)
{
return g_object_new (CLUTTER_TYPE_RECTANGLE, NULL);
}
/**
* clutter_rectangle_new_with_color:
* @color: a #ClutterColor
*
* Creates a new #ClutterActor with a rectangular shape
* and of the given @color.
*
* Return value: a new #ClutterActor
*/
ClutterActor *
clutter_rectangle_new_with_color (const ClutterColor *color)
{
return g_object_new (CLUTTER_TYPE_RECTANGLE,
"color", color,
NULL);
}
/**
* clutter_rectangle_get_color:
* @rectangle: a #ClutterRectangle
* @color: (out caller-allocates): return location for a #ClutterColor
*
* Retrieves the color of @rectangle.
*/
void
clutter_rectangle_get_color (ClutterRectangle *rectangle,
ClutterColor *color)
{
ClutterRectanglePrivate *priv;
g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
g_return_if_fail (color != NULL);
priv = rectangle->priv;
color->red = priv->color.red;
color->green = priv->color.green;
color->blue = priv->color.blue;
color->alpha = priv->color.alpha;
}
/**
* clutter_rectangle_set_color:
* @rectangle: a #ClutterRectangle
* @color: a #ClutterColor
*
* Sets the color of @rectangle.
*/
void
clutter_rectangle_set_color (ClutterRectangle *rectangle,
const ClutterColor *color)
{
ClutterRectanglePrivate *priv;
g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
g_return_if_fail (color != NULL);
g_object_ref (rectangle);
priv = rectangle->priv;
priv->color.red = color->red;
priv->color.green = color->green;
priv->color.blue = color->blue;
priv->color.alpha = color->alpha;
#if 0
/* FIXME - appears to be causing border to always get drawn */
if (clutter_color_equal (&priv->color, &priv->border_color))
priv->has_border = FALSE;
else
priv->has_border = TRUE;
#endif
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
g_object_notify (G_OBJECT (rectangle), "color");
g_object_notify (G_OBJECT (rectangle), "has-border");
g_object_unref (rectangle);
}
/**
* clutter_rectangle_get_border_width:
* @rectangle: a #ClutterRectangle
*
* Gets the width (in pixels) of the border used by @rectangle
*
* Return value: the border's width
*
*
*/
guint
clutter_rectangle_get_border_width (ClutterRectangle *rectangle)
{
g_return_val_if_fail (CLUTTER_IS_RECTANGLE (rectangle), 0);
return rectangle->priv->border_width;
}
/**
* clutter_rectangle_set_border_width:
* @rectangle: a #ClutterRectangle
* @width: the width of the border
*
* Sets the width (in pixel) of the border used by @rectangle.
* A @width of 0 will unset the border.
*
*
*/
void
clutter_rectangle_set_border_width (ClutterRectangle *rectangle,
guint width)
{
ClutterRectanglePrivate *priv;
g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
priv = rectangle->priv;
if (priv->border_width != width)
{
g_object_ref (rectangle);
priv->border_width = width;
if (priv->border_width != 0)
priv->has_border = TRUE;
else
priv->has_border = FALSE;
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
g_object_notify (G_OBJECT (rectangle), "border-width");
g_object_notify (G_OBJECT (rectangle), "has-border");
g_object_unref (rectangle);
}
}
/**
* clutter_rectangle_get_border_color:
* @rectangle: a #ClutterRectangle
* @color: (out caller-allocates): return location for a #ClutterColor
*
* Gets the color of the border used by @rectangle and places
* it into @color.
*
*
*/
void
clutter_rectangle_get_border_color (ClutterRectangle *rectangle,
ClutterColor *color)
{
ClutterRectanglePrivate *priv;
g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
g_return_if_fail (color != NULL);
priv = rectangle->priv;
color->red = priv->border_color.red;
color->green = priv->border_color.green;
color->blue = priv->border_color.blue;
color->alpha = priv->border_color.alpha;
}
/**
* clutter_rectangle_set_border_color:
* @rectangle: a #ClutterRectangle
* @color: the color of the border
*
* Sets the color of the border used by @rectangle using @color
*/
void
clutter_rectangle_set_border_color (ClutterRectangle *rectangle,
const ClutterColor *color)
{
ClutterRectanglePrivate *priv;
g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
g_return_if_fail (color != NULL);
priv = rectangle->priv;
if (priv->border_color.red != color->red ||
priv->border_color.green != color->green ||
priv->border_color.blue != color->blue ||
priv->border_color.alpha != color->alpha)
{
g_object_ref (rectangle);
priv->border_color.red = color->red;
priv->border_color.green = color->green;
priv->border_color.blue = color->blue;
priv->border_color.alpha = color->alpha;
if (clutter_color_equal (&priv->color, &priv->border_color))
priv->has_border = FALSE;
else
priv->has_border = TRUE;
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
g_object_notify (G_OBJECT (rectangle), "border-color");
g_object_notify (G_OBJECT (rectangle), "has-border");
g_object_unref (rectangle);
}
}

View file

@ -1,117 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_RECTANGLE_H__
#define __CLUTTER_RECTANGLE_H__
#include <glib-object.h>
#include <clutter/clutter-actor.h>
#include <clutter/clutter-color.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_RECTANGLE (clutter_rectangle_get_type())
#define CLUTTER_RECTANGLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_RECTANGLE, ClutterRectangle))
#define CLUTTER_RECTANGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_RECTANGLE, ClutterRectangleClass))
#define CLUTTER_IS_RECTANGLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_RECTANGLE))
#define CLUTTER_IS_RECTANGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_RECTANGLE))
#define CLUTTER_RECTANGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_RECTANGLE, ClutterRectangleClass))
typedef struct _ClutterRectangle ClutterRectangle;
typedef struct _ClutterRectangleClass ClutterRectangleClass;
typedef struct _ClutterRectanglePrivate ClutterRectanglePrivate;
/**
* ClutterRectangle:
*
* The #ClutterRectangle structure contains only private data
* and should be accessed using the provided API
*
*
*/
struct _ClutterRectangle
{
/*< private >*/
ClutterActor parent;
ClutterRectanglePrivate *priv;
};
/**
* ClutterRectangleClass:
*
* The #ClutterRectangleClass structure contains only private data
*
*
*/
struct _ClutterRectangleClass
{
/*< private >*/
ClutterActorClass parent_class;
/* padding for future expansion */
void (*_clutter_rectangle1) (void);
void (*_clutter_rectangle2) (void);
void (*_clutter_rectangle3) (void);
void (*_clutter_rectangle4) (void);
};
CLUTTER_DEPRECATED_IN_1_10
GType clutter_rectangle_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_new)
ClutterActor *clutter_rectangle_new (void);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_new)
ClutterActor *clutter_rectangle_new_with_color (const ClutterColor *color);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_get_background_color)
void clutter_rectangle_get_color (ClutterRectangle *rectangle,
ClutterColor *color);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_set_background_color)
void clutter_rectangle_set_color (ClutterRectangle *rectangle,
const ClutterColor *color);
CLUTTER_DEPRECATED_IN_1_10
guint clutter_rectangle_get_border_width (ClutterRectangle *rectangle);
CLUTTER_DEPRECATED_IN_1_10
void clutter_rectangle_set_border_width (ClutterRectangle *rectangle,
guint width);
CLUTTER_DEPRECATED_IN_1_10
void clutter_rectangle_get_border_color (ClutterRectangle *rectangle,
ClutterColor *color);
CLUTTER_DEPRECATED_IN_1_10
void clutter_rectangle_set_border_color (ClutterRectangle *rectangle,
const ClutterColor *color);
G_END_DECLS
#endif /* __CLUTTER_RECTANGLE_H__ */

File diff suppressed because it is too large Load diff

View file

@ -1,144 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_SCORE_H__
#define __CLUTTER_SCORE_H__
#include <clutter/clutter-timeline.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_SCORE (clutter_score_get_type ())
#define CLUTTER_SCORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SCORE, ClutterScore))
#define CLUTTER_SCORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SCORE, ClutterScoreClass))
#define CLUTTER_IS_SCORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SCORE))
#define CLUTTER_IS_SCORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SCORE))
#define CLUTTER_SCORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SCORE, ClutterScoreClass))
typedef struct _ClutterScore ClutterScore;
typedef struct _ClutterScorePrivate ClutterScorePrivate;
typedef struct _ClutterScoreClass ClutterScoreClass;
/**
* ClutterScore:
*
* The #ClutterScore structure contains only private data
* and should be accessed using the provided API
*
*
*/
struct _ClutterScore
{
/*< private >*/
GObject parent;
ClutterScorePrivate *priv;
};
/**
* ClutterScoreClass:
* @timeline_started: handler for the #ClutterScore::timeline-started signal
* @timeline_completed: handler for the #ClutterScore::timeline-completed
* signal
* @started: handler for the #ClutterScore::started signal
* @completed: handler for the #ClutterScore::completed signal
* @paused: handler for the #ClutterScore::paused signal
*
* The #ClutterScoreClass structure contains only private data
*
*
*/
struct _ClutterScoreClass
{
/*< private >*/
GObjectClass parent_class;
/*< public >*/
void (* timeline_started) (ClutterScore *score,
ClutterTimeline *timeline);
void (* timeline_completed) (ClutterScore *score,
ClutterTimeline *timeline);
void (* started) (ClutterScore *score);
void (* completed) (ClutterScore *score);
void (* paused) (ClutterScore *score);
/*< private >*/
/* padding for future expansion */
void (*_clutter_score_1) (void);
void (*_clutter_score_2) (void);
void (*_clutter_score_3) (void);
void (*_clutter_score_4) (void);
void (*_clutter_score_5) (void);
};
CLUTTER_DEPRECATED_IN_1_8
GType clutter_score_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_8
ClutterScore * clutter_score_new (void);
CLUTTER_DEPRECATED_IN_1_8
void clutter_score_set_loop (ClutterScore *score,
gboolean loop);
CLUTTER_DEPRECATED_IN_1_8
gboolean clutter_score_get_loop (ClutterScore *score);
CLUTTER_DEPRECATED_IN_1_8
gulong clutter_score_append (ClutterScore *score,
ClutterTimeline *parent,
ClutterTimeline *timeline);
CLUTTER_DEPRECATED_IN_1_8
gulong clutter_score_append_at_marker (ClutterScore *score,
ClutterTimeline *parent,
const gchar *marker_name,
ClutterTimeline *timeline);
CLUTTER_DEPRECATED_IN_1_8
void clutter_score_remove (ClutterScore *score,
gulong id_);
CLUTTER_DEPRECATED_IN_1_8
void clutter_score_remove_all (ClutterScore *score);
CLUTTER_DEPRECATED_IN_1_8
ClutterTimeline *clutter_score_get_timeline (ClutterScore *score,
gulong id_);
CLUTTER_DEPRECATED_IN_1_8
GSList * clutter_score_list_timelines (ClutterScore *score);
CLUTTER_DEPRECATED_IN_1_8
void clutter_score_start (ClutterScore *score);
CLUTTER_DEPRECATED_IN_1_8
void clutter_score_stop (ClutterScore *score);
CLUTTER_DEPRECATED_IN_1_8
void clutter_score_pause (ClutterScore *score);
CLUTTER_DEPRECATED_IN_1_8
void clutter_score_rewind (ClutterScore *score);
CLUTTER_DEPRECATED_IN_1_8
gboolean clutter_score_is_playing (ClutterScore *score);
G_END_DECLS
#endif /* __CLUTTER_SCORE_H__ */

View file

@ -1,942 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By: Matthew Allum <mallum@openedhand.com>
* Øyvind Kolås <pippin@o-hand.com>
* Emmanuele Bassi <ebassi@linux.intel.com>
*
* Copyright (C) 2007, 2008 OpenedHand
* Copyright (C) 2009 Intel Corp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
/**
* SECTION:clutter-shader
* @short_description: Programmable pipeline abstraction
*
* #ClutterShader is an object providing an abstraction over the
* OpenGL programmable pipeline. By using #ClutterShader<!-- -->s is
* possible to override the drawing pipeline by using small programs
* also known as "shaders".
*
* #ClutterShader is available since Clutter 0.6.
*
* #ClutterShader is deprecated since Clutter 1.8; use #ClutterShaderEffect
* in newly written code.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <glib.h>
#include <glib/gi18n-lib.h>
/* This file depends on the cogl 1.x api which isn't exposed when
* COGL_ENABLE_EXPERIMENTAL_2_0_API is defined...
*/
#undef COGL_ENABLE_EXPERIMENTAL_2_0_API
#include <cogl/cogl.h>
#include "clutter-shader.h"
#include "clutter-debug.h"
#include "clutter-private.h"
/* global list of shaders */
static GList *clutter_shaders_list = NULL;
#define CLUTTER_SHADER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_SHADER, ClutterShaderPrivate))
struct _ClutterShaderPrivate
{
guint compiled : 1; /* Shader is bound to the GL context */
guint is_enabled : 1;
guint vertex_is_glsl : 1;
guint fragment_is_glsl : 1;
gchar *vertex_source; /* GLSL source for vertex shader */
gchar *fragment_source; /* GLSL source for fragment shader */
CoglHandle program;
CoglHandle vertex_shader;
CoglHandle fragment_shader;
};
enum
{
PROP_0,
PROP_VERTEX_SOURCE,
PROP_FRAGMENT_SOURCE,
PROP_COMPILED,
PROP_ENABLED,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
G_DEFINE_TYPE (ClutterShader, clutter_shader, G_TYPE_OBJECT);
static inline void
clutter_shader_release_internal (ClutterShader *shader)
{
ClutterShaderPrivate *priv = shader->priv;
if (!priv->compiled)
return;
g_assert (priv->program != COGL_INVALID_HANDLE);
if (priv->vertex_is_glsl && priv->vertex_shader != COGL_INVALID_HANDLE)
cogl_handle_unref (priv->vertex_shader);
if (priv->fragment_is_glsl && priv->fragment_shader != COGL_INVALID_HANDLE)
cogl_handle_unref (priv->fragment_shader);
if (priv->program != COGL_INVALID_HANDLE)
cogl_handle_unref (priv->program);
priv->vertex_shader = COGL_INVALID_HANDLE;
priv->fragment_shader = COGL_INVALID_HANDLE;
priv->program = COGL_INVALID_HANDLE;
priv->compiled = FALSE;
}
static void
clutter_shader_finalize (GObject *object)
{
ClutterShader *shader;
ClutterShaderPrivate *priv;
shader = CLUTTER_SHADER (object);
priv = shader->priv;
clutter_shaders_list = g_list_remove (clutter_shaders_list, object);
g_free (priv->fragment_source);
g_free (priv->vertex_source);
G_OBJECT_CLASS (clutter_shader_parent_class)->finalize (object);
}
static void
clutter_shader_dispose (GObject *object)
{
ClutterShader *shader = CLUTTER_SHADER (object);
clutter_shader_release_internal (shader);
G_OBJECT_CLASS (clutter_shader_parent_class)->finalize (object);
}
static void
clutter_shader_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterShader *shader = CLUTTER_SHADER(object);
switch (prop_id)
{
case PROP_VERTEX_SOURCE:
clutter_shader_set_vertex_source (shader,
g_value_get_string (value), -1);
break;
case PROP_FRAGMENT_SOURCE:
clutter_shader_set_fragment_source (shader,
g_value_get_string (value), -1);
break;
case PROP_ENABLED:
clutter_shader_set_is_enabled (shader, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_shader_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterShader *shader;
ClutterShaderPrivate *priv;
shader = CLUTTER_SHADER(object);
priv = shader->priv;
switch (prop_id)
{
case PROP_VERTEX_SOURCE:
g_value_set_string (value, priv->vertex_source);
break;
case PROP_FRAGMENT_SOURCE:
g_value_set_string (value, priv->fragment_source);
break;
case PROP_COMPILED:
g_value_set_boolean (value, priv->compiled);
break;
case PROP_ENABLED:
g_value_set_boolean (value, priv->is_enabled);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static GObject *
clutter_shader_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
{
GObjectClass *parent_class;
GObject *object;
parent_class = G_OBJECT_CLASS (clutter_shader_parent_class);
object = parent_class->constructor (type, n_params, params);
/* add this instance to the global list of shaders */
clutter_shaders_list = g_list_prepend (clutter_shaders_list, object);
return object;
}
static void
clutter_shader_class_init (ClutterShaderClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec = NULL;
object_class->finalize = clutter_shader_finalize;
object_class->dispose = clutter_shader_dispose;
object_class->set_property = clutter_shader_set_property;
object_class->get_property = clutter_shader_get_property;
object_class->constructor = clutter_shader_constructor;
g_type_class_add_private (klass, sizeof (ClutterShaderPrivate));
/**
* ClutterShader:vertex-source:
*
* GLSL source code for the vertex shader part of the shader
* program, if any
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
pspec = g_param_spec_string ("vertex-source",
P_("Vertex Source"),
P_("Source of vertex shader"),
NULL,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_VERTEX_SOURCE] = pspec;
g_object_class_install_property (object_class, PROP_VERTEX_SOURCE, pspec);
/**
* ClutterShader:fragment-source:
*
* GLSL source code for the fragment shader part of the shader program.
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
pspec = g_param_spec_string ("fragment-source",
P_("Fragment Source"),
P_("Source of fragment shader"),
NULL,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_FRAGMENT_SOURCE] = pspec;
g_object_class_install_property (object_class, PROP_FRAGMENT_SOURCE, pspec);
/**
* ClutterShader:compiled:
*
* Whether the shader is compiled and linked, ready for use
* in the GL context.
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
pspec = g_param_spec_boolean ("compiled",
P_("Compiled"),
P_("Whether the shader is compiled and linked"),
FALSE,
CLUTTER_PARAM_READABLE);
obj_props[PROP_COMPILED] = pspec;
g_object_class_install_property (object_class, PROP_COMPILED, pspec);
/**
* ClutterShader:enabled:
*
* Whether the shader is currently used in the GL rendering pipeline.
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
pspec = g_param_spec_boolean ("enabled",
P_("Enabled"),
P_("Whether the shader is enabled"),
FALSE,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_ENABLED] = pspec;
g_object_class_install_property (object_class, PROP_ENABLED, pspec);
}
static void
clutter_shader_init (ClutterShader *self)
{
ClutterShaderPrivate *priv;
priv = self->priv = CLUTTER_SHADER_GET_PRIVATE (self);
priv->compiled = FALSE;
priv->vertex_source = NULL;
priv->fragment_source = NULL;
priv->program = COGL_INVALID_HANDLE;
priv->vertex_shader = COGL_INVALID_HANDLE;
priv->fragment_shader = COGL_INVALID_HANDLE;
}
/**
* clutter_shader_new:
*
* Create a new #ClutterShader instance.
*
* Return value: a new #ClutterShader.
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
ClutterShader *
clutter_shader_new (void)
{
return g_object_new (CLUTTER_TYPE_SHADER, NULL);
}
static inline void
clutter_shader_set_source (ClutterShader *shader,
ClutterShaderType shader_type,
const gchar *data,
gssize length)
{
ClutterShaderPrivate *priv = shader->priv;
gboolean is_glsl = FALSE;
if (length < 0)
length = strlen (data);
g_object_freeze_notify (G_OBJECT (shader));
/* release shader if bound when changing the source, the shader will
* automatically be rebound on the next use.
*/
if (clutter_shader_is_compiled (shader))
clutter_shader_release (shader);
is_glsl = !g_str_has_prefix (data, "!!ARBfp");
CLUTTER_NOTE (SHADER,
"setting %s shader (GLSL:%s, len:%" G_GSSIZE_FORMAT ")",
shader_type == CLUTTER_VERTEX_SHADER ? "vertex" : "fragment",
is_glsl ? "yes" : "no",
length);
switch (shader_type)
{
case CLUTTER_FRAGMENT_SHADER:
g_free (priv->fragment_source);
priv->fragment_source = g_strndup (data, length);
priv->fragment_is_glsl = is_glsl;
g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_FRAGMENT_SOURCE]);
break;
case CLUTTER_VERTEX_SHADER:
g_free (priv->vertex_source);
priv->vertex_source = g_strndup (data, length);
priv->vertex_is_glsl = is_glsl;
g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_VERTEX_SOURCE]);
break;
}
g_object_thaw_notify (G_OBJECT (shader));
}
/**
* clutter_shader_set_fragment_source:
* @shader: a #ClutterShader
* @data: GLSL source code.
* @length: length of source buffer (currently ignored)
*
* Sets the GLSL source code to be used by a #ClutterShader for the fragment
* program.
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
void
clutter_shader_set_fragment_source (ClutterShader *shader,
const gchar *data,
gssize length)
{
g_return_if_fail (CLUTTER_IS_SHADER (shader));
g_return_if_fail (data != NULL);
clutter_shader_set_source (shader, CLUTTER_FRAGMENT_SHADER, data, length);
}
/**
* clutter_shader_set_vertex_source:
* @shader: a #ClutterShader
* @data: GLSL source code.
* @length: length of source buffer (currently ignored)
*
* Sets the GLSL source code to be used by a #ClutterShader for the vertex
* program.
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
void
clutter_shader_set_vertex_source (ClutterShader *shader,
const gchar *data,
gssize length)
{
g_return_if_fail (CLUTTER_IS_SHADER (shader));
g_return_if_fail (data != NULL);
clutter_shader_set_source (shader, CLUTTER_VERTEX_SHADER, data, length);
}
static const gchar *
clutter_shader_get_source (ClutterShader *shader,
ClutterShaderType shader_type)
{
switch (shader_type)
{
case CLUTTER_FRAGMENT_SHADER:
return shader->priv->fragment_source;
case CLUTTER_VERTEX_SHADER:
return shader->priv->vertex_source;
}
return NULL;
}
static CoglHandle
clutter_shader_get_cogl_shader (ClutterShader *shader,
ClutterShaderType shader_type)
{
switch (shader_type)
{
case CLUTTER_FRAGMENT_SHADER:
return shader->priv->fragment_shader;
case CLUTTER_VERTEX_SHADER:
return shader->priv->vertex_shader;
}
return COGL_INVALID_HANDLE;
}
static gboolean
clutter_shader_glsl_bind (ClutterShader *self,
ClutterShaderType shader_type,
GError **error)
{
ClutterShaderPrivate *priv = self->priv;
CoglHandle shader = COGL_INVALID_HANDLE;
switch (shader_type)
{
case CLUTTER_VERTEX_SHADER:
shader = cogl_create_shader (COGL_SHADER_TYPE_VERTEX);
cogl_shader_source (shader, priv->vertex_source);
priv->vertex_shader = shader;
break;
case CLUTTER_FRAGMENT_SHADER:
shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
cogl_shader_source (shader, priv->fragment_source);
priv->fragment_shader = shader;
break;
}
g_assert (shader != COGL_INVALID_HANDLE);
cogl_shader_compile (shader);
if (!cogl_shader_is_compiled (shader))
{
gchar *log_buf;
log_buf = cogl_shader_get_info_log (shader);
/* translators: the first %s is the type of the shader, either
* Vertex shader or Fragment shader; the second %s is the actual
* error as reported by COGL
*/
g_set_error (error, CLUTTER_SHADER_ERROR,
CLUTTER_SHADER_ERROR_COMPILE,
_("%s compilation failed: %s"),
shader_type == CLUTTER_VERTEX_SHADER ? _("Vertex shader")
: _("Fragment shader"),
log_buf);
g_free (log_buf);
return FALSE;
}
cogl_program_attach_shader (priv->program, shader);
return TRUE;
}
static gboolean
bind_glsl_shader (ClutterShader *self,
GError **error)
{
ClutterShaderPrivate *priv = self->priv;
GError *bind_error = NULL;
gboolean res;
priv->program = cogl_create_program ();
if (priv->vertex_is_glsl && priv->vertex_source != COGL_INVALID_HANDLE)
{
res = clutter_shader_glsl_bind (self,
CLUTTER_VERTEX_SHADER,
&bind_error);
if (!res)
{
g_propagate_error (error, bind_error);
return FALSE;
}
}
if (priv->fragment_is_glsl && priv->fragment_source != COGL_INVALID_HANDLE)
{
res = clutter_shader_glsl_bind (self,
CLUTTER_FRAGMENT_SHADER,
&bind_error);
if (!res)
{
g_propagate_error (error, bind_error);
return FALSE;
}
}
cogl_program_link (priv->program);
return TRUE;
}
/**
* clutter_shader_compile:
* @shader: a #ClutterShader
* @error: return location for a #GError, or %NULL
*
* Compiles and links GLSL sources set for vertex and fragment shaders for
* a #ClutterShader. If the compilation fails and a #GError return location is
* provided the error will contain the errors from the compiler, if any.
*
* Return value: returns TRUE if the shader was succesfully compiled.
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
gboolean
clutter_shader_compile (ClutterShader *shader,
GError **error)
{
ClutterShaderPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), FALSE);
priv = shader->priv;
if (priv->compiled)
return priv->compiled;
if ((priv->vertex_source != COGL_INVALID_HANDLE && !priv->vertex_is_glsl) ||
(priv->fragment_source != COGL_INVALID_HANDLE && !priv->fragment_is_glsl))
{
/* XXX: Could remove this check, since we only advertise support for GLSL
* shaders anyways. */
g_set_error (error, CLUTTER_SHADER_ERROR,
CLUTTER_SHADER_ERROR_NO_ASM,
"ASM shaders not supported");
priv->compiled = FALSE;
return priv->compiled;
}
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
{
g_set_error (error, CLUTTER_SHADER_ERROR,
CLUTTER_SHADER_ERROR_NO_GLSL,
"GLSL shaders not supported");
priv->compiled = FALSE;
return priv->compiled;
}
priv->compiled = bind_glsl_shader (shader, error);
g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_COMPILED]);
return priv->compiled;
}
/**
* clutter_shader_release:
* @shader: a #ClutterShader
*
* Frees up any GL context resources held by the shader.
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
void
clutter_shader_release (ClutterShader *shader)
{
g_return_if_fail (CLUTTER_IS_SHADER (shader));
clutter_shader_release_internal (shader);
g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_COMPILED]);
}
/**
* clutter_shader_is_compiled:
* @shader: a #ClutterShader
*
* Checks whether @shader is is currently compiled, linked and bound
* to the GL context.
*
* Return value: %TRUE if the shader is compiled, linked and ready for use.
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
gboolean
clutter_shader_is_compiled (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), FALSE);
return shader->priv->compiled;
}
/**
* clutter_shader_set_is_enabled:
* @shader: a #ClutterShader
* @enabled: The new state of the shader.
*
* Enables a shader. This function will attempt to compile and link
* the shader, if it isn't already.
*
* When @enabled is %FALSE the default state of the GL pipeline will be
* used instead.
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
void
clutter_shader_set_is_enabled (ClutterShader *shader,
gboolean enabled)
{
ClutterShaderPrivate *priv;
g_return_if_fail (CLUTTER_IS_SHADER (shader));
priv = shader->priv;
if (priv->is_enabled != enabled)
{
GError *error = NULL;
gboolean res;
res = clutter_shader_compile (shader, &error);
if (!res)
{
g_warning ("Unable to bind the shader: %s",
error ? error->message : "unknown error");
if (error)
g_error_free (error);
return;
}
priv->is_enabled = enabled;
if (priv->is_enabled)
cogl_program_use (priv->program);
else
cogl_program_use (COGL_INVALID_HANDLE);
g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_ENABLED]);
}
}
/**
* clutter_shader_get_is_enabled:
* @shader: a #ClutterShader
*
* Checks whether @shader is enabled.
*
* Return value: %TRUE if the shader is enabled.
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
gboolean
clutter_shader_get_is_enabled (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), FALSE);
return shader->priv->is_enabled;
}
/**
* clutter_shader_set_uniform:
* @shader: a #ClutterShader.
* @name: name of uniform in GLSL shader program to set.
* @value: a #ClutterShaderFloat, #ClutterShaderInt or #ClutterShaderMatrix
* #GValue.
*
* Sets a user configurable variable in the GLSL shader programs attached to
* a #ClutterShader.
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
void
clutter_shader_set_uniform (ClutterShader *shader,
const gchar *name,
const GValue *value)
{
ClutterShaderPrivate *priv;
int location = 0;
gsize size;
g_return_if_fail (CLUTTER_IS_SHADER (shader));
g_return_if_fail (name != NULL);
g_return_if_fail (value != NULL);
g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value) ||
CLUTTER_VALUE_HOLDS_SHADER_INT (value) ||
CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value) ||
G_VALUE_HOLDS_FLOAT (value) ||
G_VALUE_HOLDS_INT (value));
priv = shader->priv;
g_return_if_fail (priv->program != COGL_INVALID_HANDLE);
location = cogl_program_get_uniform_location (priv->program, name);
if (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value))
{
const float *floats;
floats = clutter_value_get_shader_float (value, &size);
cogl_program_set_uniform_float (priv->program,
location, size, 1, floats);
}
else if (CLUTTER_VALUE_HOLDS_SHADER_INT (value))
{
const int *ints;
ints = clutter_value_get_shader_int (value, &size);
cogl_program_set_uniform_int (priv->program,
location, size, 1, ints);
}
else if (CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value))
{
const float *matrix;
matrix = clutter_value_get_shader_matrix (value, &size);
cogl_program_set_uniform_matrix (priv->program,
location, size, 1, FALSE, matrix);
}
else if (G_VALUE_HOLDS_FLOAT (value))
{
float float_val = g_value_get_float (value);
cogl_program_set_uniform_float (priv->program,
location, 1, 1, &float_val);
}
else if (G_VALUE_HOLDS_INT (value))
{
int int_val = g_value_get_int (value);
cogl_program_set_uniform_int (priv->program,
location, 1, 1, &int_val);
}
else
g_assert_not_reached ();
}
/**
* clutter_shader_get_fragment_source:
* @shader: a #ClutterShader
*
* Query the current GLSL fragment source set on @shader.
*
* Return value: the source of the fragment shader for this
* ClutterShader object or %NULL. The returned string is owned by the
* shader object and should never be modified or freed
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
const gchar *
clutter_shader_get_fragment_source (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
return clutter_shader_get_source (shader, CLUTTER_FRAGMENT_SHADER);
}
/**
* clutter_shader_get_vertex_source:
* @shader: a #ClutterShader
*
* Query the current GLSL vertex source set on @shader.
*
* Return value: the source of the vertex shader for this
* ClutterShader object or %NULL. The returned string is owned by the
* shader object and should never be modified or freed
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
const gchar *
clutter_shader_get_vertex_source (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
return clutter_shader_get_source (shader, CLUTTER_VERTEX_SHADER);
}
/**
* clutter_shader_get_cogl_program:
* @shader: a #ClutterShader
*
* Retrieves the underlying #CoglHandle for the shader program.
*
* Return value: (transfer none): A #CoglHandle for the shader program,
* or %NULL. The handle is owned by the #ClutterShader and it should
* not be unreferenced
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
CoglHandle
clutter_shader_get_cogl_program (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
return shader->priv->program;
}
/**
* clutter_shader_get_cogl_fragment_shader:
* @shader: a #ClutterShader
*
* Retrieves the underlying #CoglHandle for the fragment shader.
*
* Return value: (transfer none): A #CoglHandle for the fragment
* shader, or %NULL. The handle is owned by the #ClutterShader
* and it should not be unreferenced
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
CoglHandle
clutter_shader_get_cogl_fragment_shader (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
return clutter_shader_get_cogl_shader (shader, CLUTTER_FRAGMENT_SHADER);
}
/**
* clutter_shader_get_cogl_vertex_shader:
* @shader: a #ClutterShader
*
* Retrieves the underlying #CoglHandle for the vertex shader.
*
* Return value: (transfer none): A #CoglHandle for the vertex
* shader, or %NULL. The handle is owned by the #ClutterShader
* and it should not be unreferenced
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
CoglHandle
clutter_shader_get_cogl_vertex_shader (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
return clutter_shader_get_cogl_shader (shader, CLUTTER_VERTEX_SHADER);
}
GQuark
clutter_shader_error_quark (void)
{
return g_quark_from_static_string ("clutter-shader-error");
}

View file

@ -1,182 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Øyvind Kolås <pippin@o-hand.com>
*
* Copyright (C) 2007 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_SHADER_H__
#define __CLUTTER_SHADER_H__
#include <clutter/clutter-types.h>
#include <clutter/clutter-shader-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_SHADER (clutter_shader_get_type ())
#define CLUTTER_SHADER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CLUTTER_TYPE_SHADER, ClutterShader))
#define CLUTTER_SHADER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CLUTTER_TYPE_SHADER, ClutterShaderClass))
#define CLUTTER_IS_SHADER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CLUTTER_TYPE_SHADER))
#define CLUTTER_IS_SHADER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CLUTTER_TYPE_SHADER))
#define CLUTTER_SHADER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CLUTTER_TYPE_SHADER, ClutterShaderClass))
/**
* CLUTTER_SHADER_ERROR:
*
* Error domain for #ClutterShader errors
*
*
*
* Deprecated: 1.8
*/
#define CLUTTER_SHADER_ERROR (clutter_shader_error_quark ())
/**
* ClutterShaderError:
* @CLUTTER_SHADER_ERROR_NO_ASM: No ASM shaders support
* @CLUTTER_SHADER_ERROR_NO_GLSL: No GLSL shaders support
* @CLUTTER_SHADER_ERROR_COMPILE: Compilation error
*
* #ClutterShader error enumeration
*
*
*
* Deprecated: 1.8
*/
typedef enum {
CLUTTER_SHADER_ERROR_NO_ASM,
CLUTTER_SHADER_ERROR_NO_GLSL,
CLUTTER_SHADER_ERROR_COMPILE
} ClutterShaderError;
typedef struct _ClutterShaderPrivate ClutterShaderPrivate;
typedef struct _ClutterShaderClass ClutterShaderClass;
/**
* ClutterShader:
*
* The #ClutterShader structure contains only private data
* and should be accessed using the provided API
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead
*/
struct _ClutterShader
{
/*< private >*/
GObject parent;
ClutterShaderPrivate *priv;
};
/**
* ClutterShaderClass:
*
* The #ClutterShaderClass structure contains only private data
*
*
*
* Deprecated: 1.8: Use #ClutterShaderEffectClass instead
*/
struct _ClutterShaderClass
{
/*< private >*/
GObjectClass parent_class;
};
CLUTTER_DEPRECATED_IN_1_8
GQuark clutter_shader_error_quark (void);
CLUTTER_DEPRECATED_IN_1_8
GType clutter_shader_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
ClutterShader * clutter_shader_new (void);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
void clutter_shader_set_is_enabled (ClutterShader *shader,
gboolean enabled);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
gboolean clutter_shader_get_is_enabled (ClutterShader *shader);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
gboolean clutter_shader_compile (ClutterShader *shader,
GError **error);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
void clutter_shader_release (ClutterShader *shader);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
gboolean clutter_shader_is_compiled (ClutterShader *shader);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
void clutter_shader_set_vertex_source (ClutterShader *shader,
const gchar *data,
gssize length);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
void clutter_shader_set_fragment_source (ClutterShader *shader,
const gchar *data,
gssize length);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
const gchar * clutter_shader_get_vertex_source (ClutterShader *shader);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
const gchar * clutter_shader_get_fragment_source (ClutterShader *shader);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
void clutter_shader_set_uniform (ClutterShader *shader,
const gchar *name,
const GValue *value);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
CoglHandle clutter_shader_get_cogl_program (ClutterShader *shader);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
CoglHandle clutter_shader_get_cogl_fragment_shader (ClutterShader *shader);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterShaderEffect)
CoglHandle clutter_shader_get_cogl_vertex_shader (ClutterShader *shader);
/* ClutterActor methods */
CLUTTER_DEPRECATED_IN_1_8_FOR(clutter_actor_add_effect)
gboolean clutter_actor_set_shader (ClutterActor *self,
ClutterShader *shader);
CLUTTER_DEPRECATED_IN_1_8_FOR(clutter_actor_get_effect)
ClutterShader * clutter_actor_get_shader (ClutterActor *self);
CLUTTER_DEPRECATED_IN_1_8_FOR(clutter_shader_effect_set_uniform_value)
void clutter_actor_set_shader_param (ClutterActor *self,
const gchar *param,
const GValue *value);
CLUTTER_DEPRECATED_IN_1_8_FOR(clutter_shader_effect_set_uniform)
void clutter_actor_set_shader_param_int (ClutterActor *self,
const gchar *param,
gint value);
CLUTTER_DEPRECATED_IN_1_8_FOR(clutter_shader_effect_set_uniform)
void clutter_actor_set_shader_param_float (ClutterActor *self,
const gchar *param,
gfloat value);
G_END_DECLS
#endif /* __CLUTTER_SHADER_H__ */

View file

@ -1,42 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2008 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_STAGE_MANAGER_DEPRECATED_H__
#define __CLUTTER_STAGE_MANAGER_DEPRECATED_H__
#include <clutter/clutter-stage-manager.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_IN_1_2
void clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager,
ClutterStage *stage);
G_END_DECLS
#endif /*__CLUTTER_STAGE_MANAGER_DEPRECATED_H__ */

View file

@ -1,102 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2011 Intel Corp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_STAGE_DEPRECATED_H__
#define __CLUTTER_STAGE_DEPRECATED_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#ifndef CLUTTER_DISABLE_DEPRECATED
/**
* CLUTTER_STAGE_WIDTH:
*
* Macro that evaluates to the width of the default stage
*
*
*
* Deprecated: 1.2: Use clutter_actor_get_width() instead
*/
#define CLUTTER_STAGE_WIDTH() (clutter_actor_get_width (clutter_stage_get_default ()))
/**
* CLUTTER_STAGE_HEIGHT:
*
* Macro that evaluates to the height of the default stage
*
*
*
* Deprecated: 1.2: use clutter_actor_get_height() instead
*/
#define CLUTTER_STAGE_HEIGHT() (clutter_actor_get_height (clutter_stage_get_default ()))
/* Commodity macro, for mallum only */
#define clutter_stage_add(stage,actor) G_STMT_START { \
if (CLUTTER_IS_STAGE ((stage)) && CLUTTER_IS_ACTOR ((actor))) \
{ \
ClutterContainer *_container = (ClutterContainer *) (stage); \
ClutterActor *_actor = (ClutterActor *) (actor); \
clutter_container_add_actor (_container, _actor); \
} } G_STMT_END
#endif /* CLUTTER_DISABLE_DEPRECATED */
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_stage_new)
ClutterActor * clutter_stage_get_default (void);
CLUTTER_DEPRECATED_IN_1_10
gboolean clutter_stage_is_default (ClutterStage *stage);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_queue_redraw)
void clutter_stage_queue_redraw (ClutterStage *stage);
CLUTTER_DEPRECATED_IN_1_10
void clutter_stage_set_use_fog (ClutterStage *stage,
gboolean fog);
CLUTTER_DEPRECATED_IN_1_10
gboolean clutter_stage_get_use_fog (ClutterStage *stage);
CLUTTER_DEPRECATED_IN_1_10
void clutter_stage_set_fog (ClutterStage *stage,
ClutterFog *fog);
CLUTTER_DEPRECATED_IN_1_10
void clutter_stage_get_fog (ClutterStage *stage,
ClutterFog *fog);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_set_background_color)
void clutter_stage_set_color (ClutterStage *stage,
const ClutterColor *color);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_get_background_color)
void clutter_stage_get_color (ClutterStage *stage,
ClutterColor *color);
G_END_DECLS
#endif /* __CLUTTER_STAGE_DEPRECATED_H__ */

File diff suppressed because it is too large Load diff

View file

@ -1,187 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Øyvind Kolås <pippin@linux.intel.com>
*
* Copyright (C) 2009 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CLUTTER_STATE_H__
#define __CLUTTER_STATE_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_STATE_KEY (clutter_state_key_get_type ())
#define CLUTTER_TYPE_STATE (clutter_state_get_type ())
#define CLUTTER_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STATE, ClutterState))
#define CLUTTER_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STATE, ClutterStateClass))
#define CLUTTER_IS_STATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STATE))
#define CLUTTER_IS_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STATE))
#define CLUTTER_STATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STATE, ClutterStateClass))
typedef struct _ClutterStatePrivate ClutterStatePrivate;
typedef struct _ClutterStateClass ClutterStateClass;
/**
* ClutterStateKey:
*
* <structname>ClutterStateKey</structname> is an opaque structure whose
* members cannot be accessed directly
*
*
*/
typedef struct _ClutterStateKey ClutterStateKey;
/**
* ClutterState:
*
* The <structname>ClutterState</structname> structure contains only
* private data and should be accessed using the provided API
*
*
*/
struct _ClutterState
{
/*< private >*/
GObject parent;
ClutterStatePrivate *priv;
};
/**
* ClutterStateClass:
* @completed: class handler for the #ClutterState::completed signal
*
* The <structname>ClutterStateClass</structname> structure contains
* only private data
*
*
*
* Deprecated: 1.12
*/
struct _ClutterStateClass
{
/*< private >*/
GObjectClass parent_class;
/*< public >*/
void (* completed) (ClutterState *state);
/*< private >*/
/* padding for future expansion */
gpointer _padding_dummy[8];
};
CLUTTER_DEPRECATED_IN_1_12
GType clutter_state_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_12
ClutterState *clutter_state_new (void);
CLUTTER_DEPRECATED_IN_1_12
ClutterTimeline * clutter_state_set_state (ClutterState *state,
const gchar *target_state_name);
CLUTTER_DEPRECATED_IN_1_12
ClutterTimeline * clutter_state_warp_to_state (ClutterState *state,
const gchar *target_state_name);
CLUTTER_DEPRECATED_IN_1_12
ClutterState * clutter_state_set_key (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
GObject *object,
const gchar *property_name,
guint mode,
const GValue *value,
gdouble pre_delay,
gdouble post_delay);
CLUTTER_DEPRECATED_IN_1_12
void clutter_state_set_duration (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
guint duration);
CLUTTER_DEPRECATED_IN_1_12
guint clutter_state_get_duration (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name);
CLUTTER_DEPRECATED_IN_1_12
void clutter_state_set (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
gpointer first_object,
const gchar *first_property_name,
gulong first_mode,
...) G_GNUC_NULL_TERMINATED;
CLUTTER_DEPRECATED_IN_1_12
GList * clutter_state_get_states (ClutterState *state);
CLUTTER_DEPRECATED_IN_1_12
GList * clutter_state_get_keys (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
GObject *object,
const gchar *property_name);
CLUTTER_DEPRECATED_IN_1_12
void clutter_state_remove_key (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
GObject *object,
const gchar *property_name);
CLUTTER_DEPRECATED_IN_1_12
ClutterTimeline * clutter_state_get_timeline (ClutterState *state);
CLUTTER_DEPRECATED_IN_1_12
void clutter_state_set_animator (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
ClutterAnimator *animator);
CLUTTER_DEPRECATED_IN_1_12
ClutterAnimator * clutter_state_get_animator (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name);
CLUTTER_DEPRECATED_IN_1_12
const gchar * clutter_state_get_state (ClutterState *state);
/*
* ClutterStateKey
*/
CLUTTER_DEPRECATED_IN_1_12
GType clutter_state_key_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_IN_1_12
gdouble clutter_state_key_get_pre_delay (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED_IN_1_12
gdouble clutter_state_key_get_post_delay (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED_IN_1_12
gulong clutter_state_key_get_mode (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_state_key_get_value (const ClutterStateKey *state_key,
GValue *value);
CLUTTER_DEPRECATED_IN_1_12
GType clutter_state_key_get_property_type (const ClutterStateKey *key);
CLUTTER_DEPRECATED_IN_1_12
GObject * clutter_state_key_get_object (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED_IN_1_12
const gchar * clutter_state_key_get_property_name (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED_IN_1_12
const gchar * clutter_state_key_get_source_state_name (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED_IN_1_12
const gchar * clutter_state_key_get_target_state_name (const ClutterStateKey *state_key);
G_END_DECLS
#endif /* __CLUTTER_STATE_H__ */

File diff suppressed because it is too large Load diff

View file

@ -1,138 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_TEXTURE_DEPRECATED_H__
#define __CLUTTER_TEXTURE_DEPRECATED_H__
#include <clutter/clutter-texture.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_image_new)
ClutterActor * clutter_texture_new (void);
CLUTTER_DEPRECATED_IN_1_12
ClutterActor * clutter_texture_new_from_file (const gchar *filename,
GError **error);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_texture_set_from_file (ClutterTexture *texture,
const gchar *filename,
GError **error);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_image_set_data)
gboolean clutter_texture_set_from_rgb_data (ClutterTexture *texture,
const guchar *data,
gboolean has_alpha,
gint width,
gint height,
gint rowstride,
gint bpp,
ClutterTextureFlags flags,
GError **error);
CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_image_set_area)
gboolean clutter_texture_set_area_from_rgb_data (ClutterTexture *texture,
const guchar *data,
gboolean has_alpha,
gint x,
gint y,
gint width,
gint height,
gint rowstride,
gint bpp,
ClutterTextureFlags flags,
GError **error);
CLUTTER_DEPRECATED_IN_1_12
void clutter_texture_get_base_size (ClutterTexture *texture,
gint *width,
gint *height);
CLUTTER_DEPRECATED_IN_1_12
void clutter_texture_set_filter_quality (ClutterTexture *texture,
ClutterTextureQuality filter_quality);
CLUTTER_DEPRECATED_IN_1_12
ClutterTextureQuality clutter_texture_get_filter_quality (ClutterTexture *texture);
CLUTTER_DEPRECATED_IN_1_12
CoglHandle clutter_texture_get_cogl_texture (ClutterTexture *texture);
CLUTTER_DEPRECATED_IN_1_12
void clutter_texture_set_cogl_texture (ClutterTexture *texture,
CoglHandle cogl_tex);
CLUTTER_DEPRECATED_IN_1_12
CoglHandle clutter_texture_get_cogl_material (ClutterTexture *texture);
CLUTTER_DEPRECATED_IN_1_12
void clutter_texture_set_cogl_material (ClutterTexture *texture,
CoglHandle cogl_material);
CLUTTER_DEPRECATED_IN_1_12
void clutter_texture_set_sync_size (ClutterTexture *texture,
gboolean sync_size);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_texture_get_sync_size (ClutterTexture *texture);
CLUTTER_DEPRECATED_IN_1_12
void clutter_texture_set_repeat (ClutterTexture *texture,
gboolean repeat_x,
gboolean repeat_y);
CLUTTER_DEPRECATED_IN_1_12
void clutter_texture_get_repeat (ClutterTexture *texture,
gboolean *repeat_x,
gboolean *repeat_y);
CLUTTER_DEPRECATED_IN_1_12
CoglPixelFormat clutter_texture_get_pixel_format (ClutterTexture *texture);
CLUTTER_DEPRECATED_IN_1_12
gint clutter_texture_get_max_tile_waste (ClutterTexture *texture);
CLUTTER_DEPRECATED_IN_1_12
void clutter_texture_set_keep_aspect_ratio (ClutterTexture *texture,
gboolean keep_aspect);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_texture_get_keep_aspect_ratio (ClutterTexture *texture);
CLUTTER_DEPRECATED_IN_1_12
void clutter_texture_set_load_async (ClutterTexture *texture,
gboolean load_async);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_texture_get_load_async (ClutterTexture *texture);
CLUTTER_DEPRECATED_IN_1_12
void clutter_texture_set_load_data_async (ClutterTexture *texture,
gboolean load_async);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_texture_get_load_data_async (ClutterTexture *texture);
CLUTTER_DEPRECATED_IN_1_12
void clutter_texture_set_pick_with_alpha (ClutterTexture *texture,
gboolean pick_with_alpha);
CLUTTER_DEPRECATED_IN_1_12
gboolean clutter_texture_get_pick_with_alpha (ClutterTexture *texture);
CLUTTER_DEPRECATED_IN_1_8_FOR(ClutterOffscreenEffect)
ClutterActor * clutter_texture_new_from_actor (ClutterActor *actor);
CLUTTER_DEPRECATED_IN_1_10
gboolean clutter_texture_set_from_yuv_data (ClutterTexture *texture,
const guchar *data,
gint width,
gint height,
ClutterTextureFlags flags,
GError **error);
G_END_DECLS
#endif /* __CLUTTER_TEXTURE_DEPRECATED_H__ */

View file

@ -1,41 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2012 Intel Corp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CLUTTER_TIMELINE_PRIVATE_H__
#define __CLUTTER_TIMELINE_PRIVATE_H__
#include <clutter/clutter-timeline.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_timeline_new)
ClutterTimeline * clutter_timeline_clone (ClutterTimeline *timeline);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_timeline_set_repeat_count)
void clutter_timeline_set_loop (ClutterTimeline *timeline,
gboolean loop);
CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_timeline_get_repeat_count)
gboolean clutter_timeline_get_loop (ClutterTimeline *timeline);
G_END_DECLS
#endif /* __CLUTTER_TIMELINE_PRIVATE_H__ */

View file

@ -1,142 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Neil Roberts <neil@linux.intel.com>
*
* Copyright (C) 2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
/* This file contains the common code to check whether an interval has
expired used in clutter-frame-source and clutter-timeout-pool. */
#include "clutter-timeout-interval.h"
void
_clutter_timeout_interval_init (ClutterTimeoutInterval *interval,
guint fps)
{
#if GLIB_CHECK_VERSION (2, 27, 3)
interval->start_time = g_get_monotonic_time () / 1000;
#else
{
GTimeVal start_time;
g_get_current_time (&start_time);
interval->start_time = start_time.tv_sec * 1000
+ start_time.tv_usec / 1000;
}
#endif
interval->fps = fps;
interval->frame_count = 0;
}
static gint64
_clutter_timeout_interval_get_ticks (gint64 current_time,
ClutterTimeoutInterval *interval)
{
return MAX (current_time - interval->start_time, 0);
}
gboolean
_clutter_timeout_interval_prepare (gint64 current_time,
ClutterTimeoutInterval *interval,
gint *delay)
{
gint elapsed_time, new_frame_num;
elapsed_time = _clutter_timeout_interval_get_ticks (current_time, interval);
new_frame_num = elapsed_time * interval->fps / 1000;
/* If time has gone backwards or the time since the last frame is
greater than the two frames worth then reset the time and do a
frame now */
if (new_frame_num < interval->frame_count ||
new_frame_num - interval->frame_count > 2)
{
/* Get the frame time rounded up to the nearest ms */
guint frame_time = (1000 + interval->fps - 1) / interval->fps;
/* Reset the start time */
interval->start_time = current_time;
/* Move the start time as if one whole frame has elapsed */
interval->start_time -= frame_time;
interval->frame_count = 0;
if (delay)
*delay = 0;
return TRUE;
}
else if (new_frame_num > interval->frame_count)
{
if (delay)
*delay = 0;
return TRUE;
}
else
{
if (delay)
*delay = ((interval->frame_count + 1) * 1000 / interval->fps
- elapsed_time);
return FALSE;
}
}
gboolean
_clutter_timeout_interval_dispatch (ClutterTimeoutInterval *interval,
GSourceFunc callback,
gpointer user_data)
{
if ((* callback) (user_data))
{
interval->frame_count++;
return TRUE;
}
return FALSE;
}
gint
_clutter_timeout_interval_compare_expiration (const ClutterTimeoutInterval *a,
const ClutterTimeoutInterval *b)
{
guint a_delay = 1000 / a->fps;
guint b_delay = 1000 / b->fps;
gint64 b_difference;
gint comparison;
b_difference = a->start_time - b->start_time;
comparison = ((gint) ((a->frame_count + 1) * a_delay)
- (gint) ((b->frame_count + 1) * b_delay + b_difference));
return (comparison < 0 ? -1
: comparison > 0 ? 1
: 0);
}

View file

@ -1,58 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Neil Roberts <neil@linux.intel.com>
*
* Copyright (C) 2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CLUTTER_TIMEOUT_INTERVAL_H__
#define __CLUTTER_TIMEOUT_INTERVAL_H__
#include <glib.h>
G_BEGIN_DECLS
typedef struct _ClutterTimeoutInterval ClutterTimeoutInterval;
struct _ClutterTimeoutInterval
{
/* milliseconds */
gint64 start_time;
guint frame_count;
guint fps;
};
void _clutter_timeout_interval_init (ClutterTimeoutInterval *interval,
guint fps);
gboolean _clutter_timeout_interval_prepare (gint64 current_time,
ClutterTimeoutInterval *interval,
gint *delay);
gboolean _clutter_timeout_interval_dispatch (ClutterTimeoutInterval *interval,
GSourceFunc callback,
gpointer user_data);
gint _clutter_timeout_interval_compare_expiration (const ClutterTimeoutInterval *a,
const ClutterTimeoutInterval *b);
G_END_DECLS
#endif /* __CLUTTER_TIMEOUT_INTERVAL_H__ */

View file

@ -1,500 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*
* ClutterTimeoutPool: pool of timeout functions using the same slice of
* the GLib main loop
*
* Author: Emmanuele Bassi <ebassi@openedhand.com>
*
* Based on similar code by Tristan van Berkom
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-main.h"
#include "clutter-timeout-pool.h"
#include "clutter-debug.h"
#include "clutter-timeout-interval.h"
typedef struct _ClutterTimeout ClutterTimeout;
typedef enum {
CLUTTER_TIMEOUT_NONE = 0,
CLUTTER_TIMEOUT_READY = 1 << 1
} ClutterTimeoutFlags;
struct _ClutterTimeout
{
guint id;
ClutterTimeoutFlags flags;
gint refcount;
ClutterTimeoutInterval interval;
GSourceFunc func;
gpointer data;
GDestroyNotify notify;
};
struct _ClutterTimeoutPool
{
GSource source;
guint next_id;
GList *timeouts;
GList *dispatched_timeouts;
gint ready;
guint id;
};
#define TIMEOUT_READY(timeout) (timeout->flags & CLUTTER_TIMEOUT_READY)
static gboolean clutter_timeout_pool_prepare (GSource *source,
gint *next_timeout);
static gboolean clutter_timeout_pool_check (GSource *source);
static gboolean clutter_timeout_pool_dispatch (GSource *source,
GSourceFunc callback,
gpointer data);
static void clutter_timeout_pool_finalize (GSource *source);
static GSourceFuncs clutter_timeout_pool_funcs =
{
clutter_timeout_pool_prepare,
clutter_timeout_pool_check,
clutter_timeout_pool_dispatch,
clutter_timeout_pool_finalize
};
static gint
clutter_timeout_sort (gconstpointer a,
gconstpointer b)
{
const ClutterTimeout *t_a = a;
const ClutterTimeout *t_b = b;
/* Keep 'ready' timeouts at the front */
if (TIMEOUT_READY (t_a))
return -1;
if (TIMEOUT_READY (t_b))
return 1;
return _clutter_timeout_interval_compare_expiration (&t_a->interval,
&t_b->interval);
}
static gint
clutter_timeout_find_by_id (gconstpointer a,
gconstpointer b)
{
const ClutterTimeout *t_a = a;
return t_a->id == GPOINTER_TO_UINT (b) ? 0 : 1;
}
static ClutterTimeout *
clutter_timeout_new (guint fps)
{
ClutterTimeout *timeout;
timeout = g_slice_new0 (ClutterTimeout);
_clutter_timeout_interval_init (&timeout->interval, fps);
timeout->flags = CLUTTER_TIMEOUT_NONE;
timeout->refcount = 1;
return timeout;
}
static gboolean
clutter_timeout_prepare (ClutterTimeoutPool *pool,
ClutterTimeout *timeout,
gint *next_timeout)
{
GSource *source = (GSource *) pool;
gint64 now;
#if GLIB_CHECK_VERSION (2, 27, 3)
now = g_source_get_time (source) / 1000;
#else
{
GTimeVal source_time;
g_source_get_current_time (source, &source_time);
now = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
}
#endif
return _clutter_timeout_interval_prepare (now,
&timeout->interval,
next_timeout);
}
/* ref and unref are always called under the main Clutter lock, so there
* is not need for us to use g_atomic_int_* API.
*/
static ClutterTimeout *
clutter_timeout_ref (ClutterTimeout *timeout)
{
g_return_val_if_fail (timeout != NULL, timeout);
g_return_val_if_fail (timeout->refcount > 0, timeout);
timeout->refcount += 1;
return timeout;
}
static void
clutter_timeout_unref (ClutterTimeout *timeout)
{
g_return_if_fail (timeout != NULL);
g_return_if_fail (timeout->refcount > 0);
timeout->refcount -= 1;
if (timeout->refcount == 0)
{
if (timeout->notify)
timeout->notify (timeout->data);
g_slice_free (ClutterTimeout, timeout);
}
}
static void
clutter_timeout_free (ClutterTimeout *timeout)
{
if (G_LIKELY (timeout))
{
if (timeout->notify)
timeout->notify (timeout->data);
g_slice_free (ClutterTimeout, timeout);
}
}
static gboolean
clutter_timeout_pool_prepare (GSource *source,
gint *next_timeout)
{
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
GList *l = pool->timeouts;
/* the pool is ready if the first timeout is ready */
if (l && l->data)
{
ClutterTimeout *timeout = l->data;
return clutter_timeout_prepare (pool, timeout, next_timeout);
}
else
{
*next_timeout = -1;
return FALSE;
}
}
static gboolean
clutter_timeout_pool_check (GSource *source)
{
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
GList *l;
clutter_threads_enter ();
for (l = pool->timeouts; l; l = l->next)
{
ClutterTimeout *timeout = l->data;
/* since the timeouts are sorted by expiration, as soon
* as we get a check returning FALSE we know that the
* following timeouts are not expiring, so we break as
* soon as possible
*/
if (clutter_timeout_prepare (pool, timeout, NULL))
{
timeout->flags |= CLUTTER_TIMEOUT_READY;
pool->ready += 1;
}
else
break;
}
clutter_threads_leave ();
return (pool->ready > 0);
}
static gboolean
clutter_timeout_pool_dispatch (GSource *source,
GSourceFunc func,
gpointer data)
{
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
GList *dispatched_timeouts;
/* the main loop might have predicted this, so we repeat the
* check for ready timeouts.
*/
if (!pool->ready)
clutter_timeout_pool_check (source);
clutter_threads_enter ();
/* Iterate by moving the actual start of the list along so that it
* can cope with adds and removes while a timeout is being dispatched
*/
while (pool->timeouts && pool->timeouts->data && pool->ready-- > 0)
{
ClutterTimeout *timeout = pool->timeouts->data;
GList *l;
/* One of the ready timeouts may have been removed during dispatch,
* in which case pool->ready will be wrong, but the ready timeouts
* are always kept at the start of the list so we can stop once
* we've reached the first non-ready timeout
*/
if (!(TIMEOUT_READY (timeout)))
break;
/* Add a reference to the timeout so it can't disappear
* while it's being dispatched
*/
clutter_timeout_ref (timeout);
timeout->flags &= ~CLUTTER_TIMEOUT_READY;
/* Move the list node to a list of dispatched timeouts */
l = pool->timeouts;
if (l->next)
l->next->prev = NULL;
pool->timeouts = l->next;
if (pool->dispatched_timeouts)
pool->dispatched_timeouts->prev = l;
l->prev = NULL;
l->next = pool->dispatched_timeouts;
pool->dispatched_timeouts = l;
if (!_clutter_timeout_interval_dispatch (&timeout->interval,
timeout->func, timeout->data))
{
/* The timeout may have already been removed, but nothing
* can be added to the dispatched_timeout list except in this
* function so it will always either be at the head of the
* dispatched list or have been removed
*/
if (pool->dispatched_timeouts &&
pool->dispatched_timeouts->data == timeout)
{
pool->dispatched_timeouts =
g_list_delete_link (pool->dispatched_timeouts,
pool->dispatched_timeouts);
/* Remove the reference that was held by it being in the list */
clutter_timeout_unref (timeout);
}
}
clutter_timeout_unref (timeout);
}
/* Re-insert the dispatched timeouts in sorted order */
dispatched_timeouts = pool->dispatched_timeouts;
while (dispatched_timeouts)
{
ClutterTimeout *timeout = dispatched_timeouts->data;
GList *next = dispatched_timeouts->next;
if (timeout)
pool->timeouts = g_list_insert_sorted (pool->timeouts, timeout,
clutter_timeout_sort);
dispatched_timeouts = next;
}
g_list_free (pool->dispatched_timeouts);
pool->dispatched_timeouts = NULL;
pool->ready = 0;
clutter_threads_leave ();
return TRUE;
}
static void
clutter_timeout_pool_finalize (GSource *source)
{
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
/* force destruction */
g_list_foreach (pool->timeouts, (GFunc) clutter_timeout_free, NULL);
g_list_free (pool->timeouts);
}
/**
* clutter_timeout_pool_new:
* @priority: the priority of the timeout pool. Typically this will
* be #G_PRIORITY_DEFAULT
*
* Creates a new timeout pool source. A timeout pool should be used when
* multiple timeout functions, running at the same priority, are needed and
* the g_timeout_add() API might lead to starvation of the time slice of
* the main loop. A timeout pool allocates a single time slice of the main
* loop and runs every timeout function inside it. The timeout pool is
* always sorted, so that the extraction of the next timeout function is
* a constant time operation.
*
* Return value: the newly created #ClutterTimeoutPool. The created pool
* is owned by the GLib default context and will be automatically
* destroyed when the context is destroyed. It is possible to force
* the destruction of the timeout pool using g_source_destroy()
*
*
*
* Deprecated: 1.6
*/
ClutterTimeoutPool *
clutter_timeout_pool_new (gint priority)
{
ClutterTimeoutPool *pool;
GSource *source;
source = g_source_new (&clutter_timeout_pool_funcs,
sizeof (ClutterTimeoutPool));
if (!source)
return NULL;
g_source_set_name (source, "Clutter timeout pool");
if (priority != G_PRIORITY_DEFAULT)
g_source_set_priority (source, priority);
pool = (ClutterTimeoutPool *) source;
pool->next_id = 1;
pool->id = g_source_attach (source, NULL);
/* let the default GLib context manage the pool */
g_source_unref (source);
return pool;
}
/**
* clutter_timeout_pool_add:
* @pool: a #ClutterTimeoutPool
* @fps: the time between calls to the function, in frames per second
* @func: function to call
* @data: (closure): data to pass to the function, or %NULL
* @notify: function to call when the timeout is removed, or %NULL
*
* Sets a function to be called at regular intervals, and puts it inside
* the @pool. The function is repeatedly called until it returns %FALSE,
* at which point the timeout is automatically destroyed and the function
* won't be called again. If @notify is not %NULL, the @notify function
* will be called. The first call to @func will be at the end of @interval.
*
* Since Clutter 0.8 this will try to compensate for delays. For
* example, if @func takes half the interval time to execute then the
* function will be called again half the interval time after it
* finished. Before version 0.8 it would not fire until a full
* interval after the function completes so the delay between calls
* would be @interval * 1.5. This function does not however try to
* invoke the function multiple times to catch up missing frames if
* @func takes more than @interval ms to execute.
*
* Return value: the ID (greater than 0) of the timeout inside the pool.
* Use clutter_timeout_pool_remove() to stop the timeout.
*
*
*
* Deprecated: 1.6
*/
guint
clutter_timeout_pool_add (ClutterTimeoutPool *pool,
guint fps,
GSourceFunc func,
gpointer data,
GDestroyNotify notify)
{
ClutterTimeout *timeout;
guint retval = 0;
timeout = clutter_timeout_new (fps);
retval = timeout->id = pool->next_id++;
timeout->func = func;
timeout->data = data;
timeout->notify = notify;
pool->timeouts = g_list_insert_sorted (pool->timeouts, timeout,
clutter_timeout_sort);
return retval;
}
/**
* clutter_timeout_pool_remove:
* @pool: a #ClutterTimeoutPool
* @id_: the id of the timeout to remove
*
* Removes a timeout function with @id_ from the timeout pool. The id
* is the same returned when adding a function to the timeout pool with
* clutter_timeout_pool_add().
*
*
*
* Deprecated: 1.6
*/
void
clutter_timeout_pool_remove (ClutterTimeoutPool *pool,
guint id_)
{
GList *l;
if ((l = g_list_find_custom (pool->timeouts, GUINT_TO_POINTER (id_),
clutter_timeout_find_by_id)))
{
clutter_timeout_unref (l->data);
pool->timeouts = g_list_delete_link (pool->timeouts, l);
}
else if ((l = g_list_find_custom (pool->dispatched_timeouts,
GUINT_TO_POINTER (id_),
clutter_timeout_find_by_id)))
{
clutter_timeout_unref (l->data);
pool->dispatched_timeouts =
g_list_delete_link (pool->dispatched_timeouts, l);
}
}

View file

@ -1,69 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* ClutterTimeoutPool: pool of timeout functions using the same slice of
* the GLib main loop
*
* Author: Emmanuele Bassi <ebassi@openedhand.com>
*
* Based on similar code by Tristan van Berkom
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_TIMEOUT_POOL_H__
#define __CLUTTER_TIMEOUT_POOL_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
/**
* ClutterTimeoutPool: (skip)
*
* <structname>ClutterTimeoutPool</structname> is an opaque structure
* whose members cannot be directly accessed.
*
*
*
* Deprecated: 1.6
*/
typedef struct _ClutterTimeoutPool ClutterTimeoutPool;
CLUTTER_DEPRECATED_IN_1_6
ClutterTimeoutPool *clutter_timeout_pool_new (gint priority);
CLUTTER_DEPRECATED_IN_1_6
guint clutter_timeout_pool_add (ClutterTimeoutPool *pool,
guint fps,
GSourceFunc func,
gpointer data,
GDestroyNotify notify);
CLUTTER_DEPRECATED_IN_1_6
void clutter_timeout_pool_remove (ClutterTimeoutPool *pool,
guint id_);
G_END_DECLS
#endif /* __CLUTTER_TIMEOUT_POOL_H__ */

View file

@ -1,40 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_UTIL_H__
#define __CLUTTER_UTIL_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_IN_1_2
gint clutter_util_next_p2 (gint a);
G_END_DECLS
#endif /* __CLUTTER_UTIL_H__ */

View file

@ -23,7 +23,6 @@
#ifndef __CLUTTER_STAGE_GDK_H__
#define __CLUTTER_STAGE_GDK_H__
#include <clutter/clutter-group.h>
#include <clutter/clutter-stage.h>
#include <gdk/gdk.h>

View file

@ -62,6 +62,7 @@
#include <cogl/cogl-xlib.h>
#include "clutter-backend.h"
#include "clutter-color.h"
#include "clutter-debug.h"
#include "clutter-device-manager-private.h"
#include "clutter-event-private.h"
@ -1146,31 +1147,6 @@ clutter_x11_remove_filter (ClutterX11FilterFunc func,
}
}
/**
* clutter_x11_get_input_devices:
*
* Retrieves a pointer to the list of input devices
*
* Deprecated: 1.2: Use clutter_device_manager_peek_devices() instead
*
*
*
* Return value: (transfer none) (element-type Clutter.InputDevice): a
* pointer to the internal list of input devices; the returned list is
* owned by Clutter and should not be modified or freed
*/
const GSList *
clutter_x11_get_input_devices (void)
{
ClutterDeviceManager *manager;
manager = clutter_device_manager_get_default ();
if (manager == NULL)
return NULL;
return clutter_device_manager_peek_devices (manager);
}
/**
* clutter_x11_has_xinput:
*
@ -1178,8 +1154,6 @@ clutter_x11_get_input_devices (void)
*
* Return value: %TRUE if Clutter was compiled with XInput support
* and XInput support is available at run time.
*
*
*/
gboolean
clutter_x11_has_xinput (void)

View file

@ -36,6 +36,7 @@
#include "clutter-device-manager-private.h"
#include "clutter-event-private.h"
#include "clutter-event-translator.h"
#include "clutter-keysyms.h"
#include "clutter-stage-private.h"
#include "clutter-private.h"

View file

@ -1307,37 +1307,6 @@ clutter_x11_get_stage_from_window (Window win)
return NULL;
}
/**
* clutter_x11_get_stage_visual: (skip)
* @stage: a #ClutterStage
*
* Returns an XVisualInfo suitable for creating a foreign window for the given
* stage. NOTE: It doesn't do as the name may suggest, which is return the
* XVisualInfo that was used to create an existing window for the given stage.
*
* XXX: It might be best to deprecate this function and replace with something
* along the lines of clutter_backend_x11_get_foreign_visual () or perhaps
* clutter_stage_x11_get_foreign_visual ()
*
* Return value: (transfer full): An XVisualInfo suitable for creating a
* foreign stage. Use XFree() to free the returned value instead
*
* Deprecated: 1.2: Use clutter_x11_get_visual_info() instead
*
*
*/
XVisualInfo *
clutter_x11_get_stage_visual (ClutterStage *stage)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterBackendX11 *backend_x11;
g_return_val_if_fail (CLUTTER_IS_BACKEND_X11 (backend), NULL);
backend_x11 = CLUTTER_BACKEND_X11 (backend);
return _clutter_backend_x11_get_visual_info (backend_x11);
}
typedef struct {
ClutterStageX11 *stage_x11;
cairo_rectangle_int_t geom;

View file

@ -22,10 +22,7 @@
#ifndef __CLUTTER_STAGE_X11_H__
#define __CLUTTER_STAGE_X11_H__
#include <clutter/clutter-group.h>
#include <clutter/clutter-stage.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include "clutter-backend-x11.h"
#include "cogl/clutter-stage-cogl.h"

View file

@ -38,11 +38,12 @@
#define __CLUTTER_X11_H__
#include <glib.h>
#include <clutter/clutter-types.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <clutter/clutter.h>
#include <clutter/x11/clutter-x11-texture-pixmap.h>
G_BEGIN_DECLS
@ -106,9 +107,6 @@ Window clutter_x11_get_root_window (void);
XVisualInfo *clutter_x11_get_visual_info (void);
void clutter_x11_set_display (Display * xdpy);
CLUTTER_DEPRECATED_FOR(clutter_x11_get_visual_info)
XVisualInfo *clutter_x11_get_stage_visual (ClutterStage *stage);
Window clutter_x11_get_stage_window (ClutterStage *stage);
gboolean clutter_x11_set_stage_foreign (ClutterStage *stage,
Window xwindow);
@ -125,10 +123,6 @@ gboolean clutter_x11_has_event_retrieval (void);
ClutterStage *clutter_x11_get_stage_from_window (Window win);
CLUTTER_DEPRECATED_FOR(clutter_device_manager_peek_devices)
const GSList* clutter_x11_get_input_devices (void);
CLUTTER_DEPRECATED_IN_1_14
void clutter_x11_enable_xinput (void);
gboolean clutter_x11_has_xinput (void);