summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2011-06-16 16:09:03 +0100
committerEmmanuele Bassi <ebassi@linux.intel.com>2011-06-22 12:45:11 +0100
commit13813ca0fa06228e774c93cfe89f4fb486fbd73d (patch)
treedcd53e3faf978140c89cfb45a03790e9aa61c8be
parent32fa470eb7bb6981123c024813cce2f29235c9a5 (diff)
downloadclutter-13813ca0fa06228e774c93cfe89f4fb486fbd73d.tar.gz
[2.0] Remove ClutterBehaviour
-rw-r--r--clutter/Makefile.am14
-rw-r--r--clutter/clutter-actor.c66
-rw-r--r--clutter/clutter-behaviour-depth.c305
-rw-r--r--clutter/clutter-behaviour-depth.h101
-rw-r--r--clutter/clutter-behaviour-ellipse.c1064
-rw-r--r--clutter/clutter-behaviour-ellipse.h147
-rw-r--r--clutter/clutter-behaviour-opacity.c319
-rw-r--r--clutter/clutter-behaviour-opacity.h116
-rw-r--r--clutter/clutter-behaviour-path.c474
-rw-r--r--clutter/clutter-behaviour-path.h135
-rw-r--r--clutter/clutter-behaviour-rotate.c693
-rw-r--r--clutter/clutter-behaviour-rotate.h115
-rw-r--r--clutter/clutter-behaviour-scale.c439
-rw-r--r--clutter/clutter-behaviour-scale.h106
-rw-r--r--clutter/clutter-behaviour.c708
-rw-r--r--clutter/clutter-behaviour.h166
-rw-r--r--clutter/clutter-path.c62
-rw-r--r--clutter/clutter-script.c1
-rw-r--r--clutter/clutter.h7
-rw-r--r--tests/conform/Makefile.am1
-rw-r--r--tests/conform/test-behaviours.c92
-rw-r--r--tests/conform/test-conform-main.c3
-rw-r--r--tests/conform/test-script-parser.c39
-rw-r--r--tests/data/test-script.json6
-rw-r--r--tests/interactive/Makefile.am11
-rw-r--r--tests/interactive/test-behave.c213
-rw-r--r--tests/interactive/test-scale.c117
-rw-r--r--tests/interactive/test-script.c87
-rw-r--r--tests/interactive/test-texture-async.c23
29 files changed, 72 insertions, 5558 deletions
diff --git a/clutter/Makefile.am b/clutter/Makefile.am
index 356660ec3..b90c95e1a 100644
--- a/clutter/Makefile.am
+++ b/clutter/Makefile.am
@@ -58,13 +58,6 @@ source_h = \
$(srcdir)/clutter-animation.h \
$(srcdir)/clutter-animator.h \
$(srcdir)/clutter-backend.h \
- $(srcdir)/clutter-behaviour.h \
- $(srcdir)/clutter-behaviour-depth.h \
- $(srcdir)/clutter-behaviour-ellipse.h \
- $(srcdir)/clutter-behaviour-opacity.h \
- $(srcdir)/clutter-behaviour-path.h \
- $(srcdir)/clutter-behaviour-rotate.h \
- $(srcdir)/clutter-behaviour-scale.h \
$(srcdir)/clutter-bind-constraint.h \
$(srcdir)/clutter-binding-pool.h \
$(srcdir)/clutter-bin-layout.h \
@@ -143,13 +136,6 @@ source_c = \
$(srcdir)/clutter-animation.c \
$(srcdir)/clutter-animator.c \
$(srcdir)/clutter-backend.c \
- $(srcdir)/clutter-behaviour.c \
- $(srcdir)/clutter-behaviour-depth.c \
- $(srcdir)/clutter-behaviour-ellipse.c \
- $(srcdir)/clutter-behaviour-opacity.c \
- $(srcdir)/clutter-behaviour-path.c \
- $(srcdir)/clutter-behaviour-rotate.c \
- $(srcdir)/clutter-behaviour-scale.c \
$(srcdir)/clutter-bezier.c \
$(srcdir)/clutter-bind-constraint.c \
$(srcdir)/clutter-binding-pool.c \
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 27a306a48..2151eb876 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -291,7 +291,6 @@
#include "clutter-action.h"
#include "clutter-actor-meta-private.h"
#include "clutter-animatable.h"
-#include "clutter-behaviour.h"
#include "clutter-constraint.h"
#include "clutter-container.h"
#include "clutter-debug.h"
@@ -9148,40 +9147,6 @@ parse_actor_metas (ClutterScript *script,
return g_slist_reverse (retval);
}
-static GSList *
-parse_behaviours (ClutterScript *script,
- ClutterActor *actor,
- JsonNode *node)
-{
- GList *elements, *l;
- GSList *retval = NULL;
-
- if (!JSON_NODE_HOLDS_ARRAY (node))
- return NULL;
-
- elements = json_array_get_elements (json_node_get_array (node));
-
- for (l = elements; l != NULL; l = l->next)
- {
- JsonNode *element = l->data;
- const gchar *id_ = _clutter_script_get_id_from_node (element);
- GObject *behaviour;
-
- if (id_ == NULL || *id_ == '\0')
- continue;
-
- behaviour = clutter_script_get_object (script, id_);
- if (behaviour == NULL)
- continue;
-
- retval = g_slist_prepend (retval, behaviour);
- }
-
- g_list_free (elements);
-
- return g_slist_reverse (retval);
-}
-
static gboolean
clutter_actor_parse_custom_node (ClutterScriptable *scriptable,
ClutterScript *script,
@@ -9240,17 +9205,6 @@ clutter_actor_parse_custom_node (ClutterScriptable *scriptable,
else
g_slice_free (RotationInfo, info);
}
- else if (strcmp (name, "behaviours") == 0)
- {
- GSList *l;
-
- l = parse_behaviours (script, actor, node);
-
- g_value_init (value, G_TYPE_POINTER);
- g_value_set_pointer (value, l);
-
- retval = TRUE;
- }
else if (strcmp (name, "actions") == 0 ||
strcmp (name, "constraints") == 0 ||
strcmp (name, "effects") == 0)
@@ -9310,26 +9264,6 @@ clutter_actor_set_custom_property (ClutterScriptable *scriptable,
return;
}
- if (strcmp (name, "behaviours") == 0)
- {
- GSList *behaviours, *l;
-
- if (!G_VALUE_HOLDS (value, G_TYPE_POINTER))
- return;
-
- behaviours = g_value_get_pointer (value);
- for (l = behaviours; l != NULL; l = l->next)
- {
- ClutterBehaviour *behaviour = l->data;
-
- clutter_behaviour_apply (behaviour, actor);
- }
-
- g_slist_free (behaviours);
-
- return;
- }
-
if (strcmp (name, "actions") == 0 ||
strcmp (name, "constraints") == 0 ||
strcmp (name, "effects") == 0)
diff --git a/clutter/clutter-behaviour-depth.c b/clutter/clutter-behaviour-depth.c
deleted file mode 100644
index 61512cfda..000000000
--- a/clutter/clutter-behaviour-depth.c
+++ /dev/null
@@ -1,305 +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
-
-#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 (BEHAVIOUR, "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.
- *
- * Since: 0.4
- *
- * 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.
- *
- * Since: 0.4
- *
- * 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
- *
- * Since: 0.4
- *
- * 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.
- *
- * Since: 0.6
- *
- * 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
- *
- * Since: 0.6
- *
- * 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;
-}
diff --git a/clutter/clutter-behaviour-depth.h b/clutter/clutter-behaviour-depth.h
deleted file mode 100644
index 81f0cd35c..000000000
--- a/clutter/clutter-behaviour-depth.h
+++ /dev/null
@@ -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-actor.h>
-#include <clutter/clutter-behaviour.h>
-
-G_BEGIN_DECLS
-
-#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
-
-#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
- *
- * Since: 0.2
- *
- * 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
- *
- * Since: 0.2
- *
- * Deprecated: 1.6
- */
-struct _ClutterBehaviourDepthClass
-{
- /*< private >*/
- ClutterBehaviourClass parent_class;
-};
-
-GType clutter_behaviour_depth_get_type (void) G_GNUC_CONST;
-ClutterBehaviour *clutter_behaviour_depth_new (ClutterAlpha *alpha,
- gint depth_start,
- gint depth_end);
-
-void clutter_behaviour_depth_set_bounds (ClutterBehaviourDepth *behaviour,
- gint depth_start,
- gint depth_end);
-void clutter_behaviour_depth_get_bounds (ClutterBehaviourDepth *behaviour,
- gint *depth_start,
- gint *depth_end);
-
-#endif /* CLUTTER_DISABLE_DEPRECATED */
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BEHAVIOUR_DEPTH__ */
diff --git a/clutter/clutter-behaviour-ellipse.c b/clutter/clutter-behaviour-ellipse.c
deleted file mode 100644
index 126746540..000000000
--- a/clutter/clutter-behaviour-ellipse.c
+++ /dev/null
@@ -1,1064 +0,0 @@
-
-/* -*- mode:C; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Tomas Frydrych <tf@openedhand.com>
- *
- * Copyright (C) 2007 OpenedHand Ltd
- * 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-behaviour-ellipse
- * @Title: ClutterBehaviourEllipse
- * @short_description: A behaviour interpolating position along an ellipse
- * @Deprecated: 1.6: Use clutter_actor_animate() instead
- *
- * #ClutterBehaviourEllipse interpolates actors along a path defined by
- * an ellipse.
- *
- * <note><para>When applying an ellipse behaviour to an actor, the
- * behaviour will update the actor's position and depth and set them
- * to what is dictated by the ellipses initial position.</para></note>
- *
- * Deprecated: 1.6: Use clutter_actor_animate(), #ClutterPath and a
- * #ClutterPathConstraint instead.
- *
- * Since: 0.4
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-#include <stdlib.h>
-
-#include "clutter-behaviour-ellipse.h"
-
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-private.h"
-
-G_DEFINE_TYPE (ClutterBehaviourEllipse,
- clutter_behaviour_ellipse,
- CLUTTER_TYPE_BEHAVIOUR);
-
-#define CLUTTER_BEHAVIOUR_ELLIPSE_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- CLUTTER_TYPE_BEHAVIOUR_ELLIPSE, \
- ClutterBehaviourEllipsePrivate))
-
-enum
-{
- PROP_0,
-
- PROP_CENTER,
- PROP_WIDTH,
- PROP_HEIGHT,
- PROP_ANGLE_START,
- PROP_ANGLE_END,
- PROP_ANGLE_TILT_X,
- PROP_ANGLE_TILT_Y,
- PROP_ANGLE_TILT_Z,
- PROP_DIRECTION,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-struct _ClutterBehaviourEllipsePrivate
-{
- ClutterKnot center;
-
- /* a = width / 2 */
- gint a;
-
- /* b = height / 2 */
- gint b;
-
- gdouble angle_start;
- gdouble angle_end;
-
- gdouble angle_tilt_x;
- gdouble angle_tilt_y;
- gdouble angle_tilt_z;
-
- ClutterRotateDirection direction;
-};
-
-typedef struct _knot3d
-{
- gint x;
- gint y;
- gint z;
-} knot3d;
-
-static void
-clutter_behaviour_ellipse_advance (ClutterBehaviourEllipse *e,
- float angle,
- knot3d *knot)
-{
- ClutterBehaviourEllipsePrivate *priv = e->priv;
- gint x, y, z;
-
- x = priv->a * cosf (angle * (G_PI / 180.0));
- y = priv->b * sinf (angle * (G_PI / 180.0));
- z = 0;
-
- if (priv->angle_tilt_z)
- {
- /*
- * x2 = r * cos (angle + tilt_z)
- * y2 = r * sin (angle + tilt_z)
- *
- * These can be trasformed to the formulas below using properties of
- * sin (a + b) and cos (a + b)
- *
- */
- gfloat x2, y2;
-
- x2 = x * cosf (priv->angle_tilt_z * (G_PI / 180.0))
- - y * sinf (priv->angle_tilt_z * (G_PI / 180.0));
-
- y2 = y * cosf (priv->angle_tilt_z * (G_PI / 180.0))
- + x * sinf (priv->angle_tilt_z * (G_PI / 180.0));
-
- x = (x2);
- y = (y2);
- }
-
- if (priv->angle_tilt_x)
- {
- gfloat z2, y2;
-
- z2 = - y * sinf (priv->angle_tilt_x * (G_PI / 180.0));
- y2 = y * cosf (priv->angle_tilt_x * (G_PI / 180.0));
-
- z = z2;
- y = y2;
- }
-
- if (priv->angle_tilt_y)
- {
- gfloat x2, z2;
-
- x2 = x * cosf (priv->angle_tilt_y * (G_PI / 180.0))
- - z * sinf (priv->angle_tilt_y * (G_PI / 180.0));
-
- z2 = z * cosf (priv->angle_tilt_y * (G_PI / 180.0))
- + x * sinf (priv->angle_tilt_y * (G_PI / 180.0));
-
- x = x2;
- z = z2;
- }
-
- knot->x = x;
- knot->y = y;
- knot->z = z;
-
- CLUTTER_NOTE (BEHAVIOUR, "advancing to angle %.2f [%d, %d] (a: %d, b: %d)",
- angle,
- knot->x, knot->y,
- priv->a, priv->b);
-}
-
-
-static void
-actor_apply_knot_foreach (ClutterBehaviour *behave,
- ClutterActor *actor,
- gpointer data)
-{
- ClutterBehaviourEllipsePrivate *priv;
- knot3d *knot = data;
-
- priv = ((ClutterBehaviourEllipse *) behave)->priv;
-
- clutter_actor_set_position (actor, knot->x, knot->y);
-
- if (priv->angle_tilt_x != 0 || priv->angle_tilt_y != 0)
- clutter_actor_set_depth (actor, knot->z);
-}
-
-static inline float
-clamp_angle (float a)
-{
- gint rounds;
-
- rounds = a / 360;
- if (a < 0)
- rounds--;
-
- return a - 360 * rounds;
-}
-
-static void
-clutter_behaviour_ellipse_alpha_notify (ClutterBehaviour *behave,
- gdouble alpha)
-{
- ClutterBehaviourEllipse *self = CLUTTER_BEHAVIOUR_ELLIPSE (behave);
- ClutterBehaviourEllipsePrivate *priv = self->priv;
- gfloat start, end;
- gfloat angle = 0;
- knot3d knot;
-
- /* we do everything in single precision because it's easier, even
- * though all the parameters are stored in double precision for
- * consistency with the equivalent ClutterActor API
- */
- start = priv->angle_start;
- end = priv->angle_end;
-
- if (priv->direction == CLUTTER_ROTATE_CW && start >= end)
- end += 360;
- else if (priv->direction == CLUTTER_ROTATE_CCW && start <= end)
- end -= 360;
-
- angle = (end - start) * alpha + start;
-
- clutter_behaviour_ellipse_advance (self, angle, &knot);
-
- knot.x += priv->center.x;
- knot.y += priv->center.y;
-
- clutter_behaviour_actors_foreach (behave, actor_apply_knot_foreach, &knot);
-}
-
-static void
-clutter_behaviour_ellipse_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterBehaviourEllipse *el = CLUTTER_BEHAVIOUR_ELLIPSE (gobject);
- ClutterBehaviourEllipsePrivate *priv = el->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_ANGLE_TILT_X:
- priv->angle_tilt_x = g_value_get_double (value);
- break;
-
- case PROP_ANGLE_TILT_Y:
- priv->angle_tilt_y = g_value_get_double (value);
- break;
-
- case PROP_ANGLE_TILT_Z:
- priv->angle_tilt_z = g_value_get_double (value);
- break;
-
- case PROP_WIDTH:
- clutter_behaviour_ellipse_set_width (el, g_value_get_int (value));
- break;
-
- case PROP_HEIGHT:
- clutter_behaviour_ellipse_set_height (el, g_value_get_int (value));
- break;
-
- case PROP_CENTER:
- {
- ClutterKnot *knot = g_value_get_boxed (value);
- if (knot)
- clutter_behaviour_ellipse_set_center (el, knot->x, knot->y);
- }
- break;
-
- case PROP_DIRECTION:
- priv->direction = g_value_get_enum (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_behaviour_ellipse_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterBehaviourEllipsePrivate *priv;
-
- priv = CLUTTER_BEHAVIOUR_ELLIPSE (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_ANGLE_TILT_X:
- g_value_set_double (value, priv->angle_tilt_x);
- break;
-
- case PROP_ANGLE_TILT_Y:
- g_value_set_double (value, priv->angle_tilt_y);
- break;
-
- case PROP_ANGLE_TILT_Z:
- g_value_set_double (value, priv->angle_tilt_z);
- break;
-
- case PROP_WIDTH:
- g_value_set_int (value, (priv->a * 2));
- break;
-
- case PROP_HEIGHT:
- g_value_set_int (value, (priv->b * 2));
- break;
-
- case PROP_CENTER:
- g_value_set_boxed (value, &priv->center);
- break;
-
- case PROP_DIRECTION:
- g_value_set_enum (value, priv->direction);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_behaviour_ellipse_applied (ClutterBehaviour *behave,
- ClutterActor *actor)
-{
- ClutterBehaviourEllipse *e = CLUTTER_BEHAVIOUR_ELLIPSE (behave);
- ClutterBehaviourEllipsePrivate *priv = e->priv;
- knot3d knot = { 0, };
-
- clutter_behaviour_ellipse_advance (e, priv->angle_start, &knot);
-
- clutter_actor_set_position (actor, knot.x, knot.y);
-
- /* the depth should be changed only if there is a tilt on
- * any of the X or the Y axis
- */
- if (priv->angle_tilt_x != 0 || priv->angle_tilt_y != 0)
- clutter_actor_set_depth (actor, knot.z);
-}
-
-static void
-clutter_behaviour_ellipse_class_init (ClutterBehaviourEllipseClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
- GParamSpec *pspec = NULL;
-
- g_type_class_add_private (klass, sizeof (ClutterBehaviourEllipsePrivate));
-
- object_class->set_property = clutter_behaviour_ellipse_set_property;
- object_class->get_property = clutter_behaviour_ellipse_get_property;
-
- behave_class->alpha_notify = clutter_behaviour_ellipse_alpha_notify;
- behave_class->applied = clutter_behaviour_ellipse_applied;
-
- /**
- * ClutterBehaviourEllipse:angle-start:
- *
- * The initial angle from where the rotation should start.
- *
- * Since: 0.4
- */
- pspec = g_param_spec_double ("angle-start",
- P_("Start Angle"),
- P_("Initial angle"),
- 0.0, 360.0,
- 0.0,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_ANGLE_START] = pspec;
- g_object_class_install_property (object_class, PROP_ANGLE_START, pspec);
-
- /**
- * ClutterBehaviourEllipse:angle-end:
- *
- * The final angle to where the rotation should end.
- *
- * Since: 0.4
- */
- pspec = g_param_spec_double ("angle-end",
- P_("End Angle"),
- P_("Final angle"),
- 0.0, 360.0,
- 0.0,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_ANGLE_END] = pspec;
- g_object_class_install_property (object_class, PROP_ANGLE_END, pspec);
-
- /**
- * ClutterBehaviourEllipse:angle-tilt-x:
- *
- * The tilt angle for the rotation around center in X axis
- *
- * Since: 0.4
- */
- pspec = g_param_spec_double ("angle-tilt-x",
- P_("Angle x tilt"),
- P_("Tilt of the ellipse around x axis"),
- 0.0, 360.0,
- 360.0,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_ANGLE_TILT_X] = pspec;
- g_object_class_install_property (object_class, PROP_ANGLE_TILT_X, pspec);
-
- /**
- * ClutterBehaviourEllipse:angle-tilt-y:
- *
- * The tilt angle for the rotation around center in Y axis
- *
- * Since: 0.4
- */
- pspec = g_param_spec_double ("angle-tilt-y",
- P_("Angle y tilt"),
- P_("Tilt of the ellipse around y axis"),
- 0.0, 360.0,
- 360.0,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_ANGLE_TILT_Y] = pspec;
- g_object_class_install_property (object_class, PROP_ANGLE_TILT_Y, pspec);
-
- /**
- * ClutterBehaviourEllipse:angle-tilt-z:
- *
- * The tilt angle for the rotation on the Z axis
- *
- * Since: 0.4
- */
- pspec = g_param_spec_double ("angle-tilt-z",
- P_("Angle z tilt"),
- P_("Tilt of the ellipse around z axis"),
- 0.0, 360.0,
- 360.0,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_ANGLE_TILT_Z] = pspec;
- g_object_class_install_property (object_class, PROP_ANGLE_TILT_Z, pspec);
-
- /**
- * ClutterBehaviourEllipse:width:
- *
- * Width of the ellipse, in pixels
- *
- * Since: 0.4
- */
- pspec = g_param_spec_int ("width",
- P_("Width"),
- P_("Width of the ellipse"),
- 0, G_MAXINT,
- 100,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_WIDTH] = pspec;
- g_object_class_install_property (object_class, PROP_WIDTH, pspec);
-
- /**
- * ClutterBehaviourEllipse:height:
- *
- * Height of the ellipse, in pixels
- *
- * Since: 0.4
- */
- pspec = g_param_spec_int ("height",
- P_("Height"),
- P_("Height of ellipse"),
- 0, G_MAXINT,
- 50,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_HEIGHT] = pspec;
- g_object_class_install_property (object_class, PROP_HEIGHT, pspec);
-
- /**
- * ClutterBehaviourEllipse:center:
- *
- * The center of the ellipse.
- *
- * Since: 0.4
- */
- pspec = g_param_spec_boxed ("center",
- P_("Center"),
- P_("Center of ellipse"),
- CLUTTER_TYPE_KNOT,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_CENTER] = pspec;
- g_object_class_install_property (object_class, PROP_CENTER, pspec);
-
- /**
- * ClutterBehaviourEllipse:direction:
- *
- * The direction of the rotation.
- *
- * Since: 0.4
- */
- 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 (object_class, PROP_DIRECTION, pspec);
-}
-
-static void
-clutter_behaviour_ellipse_init (ClutterBehaviourEllipse * self)
-{
- ClutterBehaviourEllipsePrivate *priv;
-
- self->priv = priv = CLUTTER_BEHAVIOUR_ELLIPSE_GET_PRIVATE (self);
-
- priv->direction = CLUTTER_ROTATE_CW;
-
- priv->angle_start = 0;
- priv->angle_end = 0;
-
- priv->a = 50;
- priv->b = 25;
-
- priv->angle_tilt_x = 360;
- priv->angle_tilt_y = 360;
- priv->angle_tilt_z = 360;
-}
-
-/**
- * clutter_behaviour_ellipse_new:
- * @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
- * @x: x coordinace of the center
- * @y: y coordiance of the center
- * @width: width of the ellipse
- * @height: height of the ellipse
- * @direction: #ClutterRotateDirection of rotation
- * @start: angle in degrees at which movement starts, between 0 and 360
- * @end: angle in degrees at which movement ends, between 0 and 360
- *
- * Creates a behaviour that drives actors along an elliptical path with
- * given center, width and height; the movement starts at @start
- * degrees (with 0 corresponding to 12 o'clock) and ends at @end
- * degrees. Angles greated than 360 degrees get clamped to the canonical
- * interval <0, 360); if @start is equal to @end, the behaviour will
- * rotate by exacly 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 #ClutterBehaviourEllipse
- *
- * Since: 0.4
- */
-ClutterBehaviour *
-clutter_behaviour_ellipse_new (ClutterAlpha *alpha,
- gint x,
- gint y,
- gint width,
- gint height,
- ClutterRotateDirection direction,
- gdouble start,
- gdouble end)
-{
- ClutterKnot center;
-
- g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
-
- center.x = x;
- center.y = y;
-
- return g_object_new (CLUTTER_TYPE_BEHAVIOUR_ELLIPSE,
- "alpha", alpha,
- "center", &center,
- "width", width,
- "height", height,
- "direction", direction,
- "angle-start", start,
- "angle-end", end,
- NULL);
-}
-
-/**
- * clutter_behaviour_ellipse_set_center:
- * @self: a #ClutterBehaviourEllipse
- * @x: x coordinace of centre
- * @y: y coordinace of centre
- *
- * Sets the center of the elliptical path to the point represented by knot.
- *
- * Since: 0.4
- */
-void
-clutter_behaviour_ellipse_set_center (ClutterBehaviourEllipse *self,
- gint x,
- gint y)
-{
- ClutterBehaviourEllipsePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
-
- priv = self->priv;
-
- if (priv->center.x != x || priv->center.y != y)
- {
- priv->center.x = x;
- priv->center.y = y;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CENTER]);
- }
-}
-
-/**
- * clutter_behaviour_ellipse_get_center:
- * @self: a #ClutterBehaviourEllipse
- * @x: (out): return location for the X coordinate of the center, or %NULL
- * @y: (out): return location for the Y coordinate of the center, or %NULL
- *
- * Gets the center of the elliptical path path.
- *
- * Since: 0.4
- */
-void
-clutter_behaviour_ellipse_get_center (ClutterBehaviourEllipse *self,
- gint *x,
- gint *y)
-{
- ClutterBehaviourEllipsePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
-
- priv = self->priv;
-
- if (x)
- *x = priv->center.x;
-
- if (y)
- *y = priv->center.y;
-}
-
-
-/**
- * clutter_behaviour_ellipse_set_width:
- * @self: a #ClutterBehaviourEllipse
- * @width: width of the ellipse
- *
- * Sets the width of the elliptical path.
- *
- * Since: 0.4
- */
-void
-clutter_behaviour_ellipse_set_width (ClutterBehaviourEllipse *self,
- gint width)
-{
- ClutterBehaviourEllipsePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
-
- priv = self->priv;
-
- if (priv->a != width / 2)
- {
- priv->a = width / 2;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_WIDTH]);
- }
-}
-
-/**
- * clutter_behaviour_ellipse_get_width:
- * @self: a #ClutterBehaviourEllipse
- *
- * Gets the width of the elliptical path.
- *
- * Return value: the width of the path
- *
- * Since: 0.4
- */
-gint
-clutter_behaviour_ellipse_get_width (ClutterBehaviourEllipse *self)
-{
- g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0);
-
- return self->priv->a * 2;
-}
-
-/**
- * clutter_behaviour_ellipse_set_height:
- * @self: a #ClutterBehaviourEllipse
- * @height: height of the ellipse
- *
- * Sets the height of the elliptical path.
- *
- * Since: 0.4
- */
-void
-clutter_behaviour_ellipse_set_height (ClutterBehaviourEllipse *self,
- gint height)
-{
- ClutterBehaviourEllipsePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
-
- priv = self->priv;
-
- if (priv->b != height / 2)
- {
- priv->b = height / 2;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_HEIGHT]);
- }
-}
-
-/**
- * clutter_behaviour_ellipse_get_height:
- * @self: a #ClutterBehaviourEllipse
- *
- * Gets the height of the elliptical path.
- *
- * Return value: the height of the path
- *
- * Since: 0.4
- */
-gint
-clutter_behaviour_ellipse_get_height (ClutterBehaviourEllipse *self)
-{
- g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0);
-
- return self->priv->b * 2;
-}
-
-/**
- * clutter_behaviour_ellipse_set_angle_start:
- * @self: a #ClutterBehaviourEllipse
- * @angle_start: angle at which movement starts in degrees, between 0 and 360.
- *
- * Sets the angle at which movement starts; angles >= 360 degress get clamped
- * to the canonical interval <0, 360).
- *
- * Since: 0.6
- */
-void
-clutter_behaviour_ellipse_set_angle_start (ClutterBehaviourEllipse *self,
- gdouble angle_start)
-{
- ClutterBehaviourEllipsePrivate *priv;
- gdouble new_angle;
-
- g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
-
- new_angle = clamp_angle (angle_start);
-
- priv = self->priv;
-
- if (priv->angle_start != new_angle)
- {
- priv->angle_start = new_angle;
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_START]);
- }
-}
-
-/**
- * clutter_behaviour_ellipse_get_angle_start:
- * @self: a #ClutterBehaviourEllipse
- *
- * Gets the angle at which movements starts.
- *
- * Return value: angle in degrees
- *
- * Since: 0.6
- */
-gdouble
-clutter_behaviour_ellipse_get_angle_start (ClutterBehaviourEllipse *self)
-{
- g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0.0);
-
- return self->priv->angle_start;
-}
-
-/**
- * clutter_behaviour_ellipse_set_angle_end:
- * @self: a #ClutterBehaviourEllipse
- * @angle_end: angle at which movement ends in degrees, between 0 and 360.
- *
- * Sets the angle at which movement ends; angles >= 360 degress get clamped
- * to the canonical interval <0, 360).
- *
- * Since: 0.4
- */
-void
-clutter_behaviour_ellipse_set_angle_end (ClutterBehaviourEllipse *self,
- gdouble angle_end)
-{
- ClutterBehaviourEllipsePrivate *priv;
- gdouble new_angle;
-
- g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
-
- new_angle = clamp_angle (angle_end);
-
- priv = self->priv;
-
- if (priv->angle_end != new_angle)
- {
- priv->angle_end = new_angle;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_END]);
- }
-}
-
-/**
- * clutter_behaviour_ellipse_get_angle_end:
- * @self: a #ClutterBehaviourEllipse
- *
- * Gets the at which movements ends.
- *
- * Return value: angle in degrees
- *
- * Since: 0.4
- */
-gdouble
-clutter_behaviour_ellipse_get_angle_end (ClutterBehaviourEllipse *self)
-{
- g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0.0);
-
- return self->priv->angle_end;
-}
-
-/**
- * clutter_behaviour_ellipse_set_angle_tilt:
- * @self: a #ClutterBehaviourEllipse
- * @axis: a #ClutterRotateAxis
- * @angle_tilt: tilt of the elipse around the center in the given axis in
- * degrees.
- *
- * Sets the angle at which the ellipse should be tilted around it's center.
- *
- * Since: 0.4
- */
-void
-clutter_behaviour_ellipse_set_angle_tilt (ClutterBehaviourEllipse *self,
- ClutterRotateAxis axis,
- gdouble angle_tilt)
-{
- ClutterBehaviourEllipsePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
-
- priv = self->priv;
-
- switch (axis)
- {
- case CLUTTER_X_AXIS:
- if (priv->angle_tilt_x != angle_tilt)
- {
- priv->angle_tilt_x = angle_tilt;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_TILT_X]);
- }
- break;
-
- case CLUTTER_Y_AXIS:
- if (priv->angle_tilt_y != angle_tilt)
- {
- priv->angle_tilt_y = angle_tilt;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_TILT_Y]);
- }
- break;
-
- case CLUTTER_Z_AXIS:
- if (priv->angle_tilt_z != angle_tilt)
- {
- priv->angle_tilt_z = angle_tilt;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_TILT_Z]);
- }
- break;
- }
-}
-
-/**
- * clutter_behaviour_ellipse_get_angle_tilt:
- * @self: a #ClutterBehaviourEllipse
- * @axis: a #ClutterRotateAxis
- *
- * Gets the tilt of the ellipse around the center in the given axis.
- *
- * Return value: angle in degrees.
- *
- * Since: 0.4
- */
-gdouble
-clutter_behaviour_ellipse_get_angle_tilt (ClutterBehaviourEllipse *self,
- ClutterRotateAxis axis)
-{
- g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0.0);
-
- switch (axis)
- {
- case CLUTTER_X_AXIS:
- return self->priv->angle_tilt_x;
-
- case CLUTTER_Y_AXIS:
- return self->priv->angle_tilt_y;
-
- case CLUTTER_Z_AXIS:
- return self->priv->angle_tilt_z;
- }
-
- return 0.0;
-}
-
-/**
- * clutter_behaviour_ellipse_set_tilt:
- * @self: a #ClutterBehaviourEllipse
- * @angle_tilt_x: tilt of the elipse around the center in X axis in degrees.
- * @angle_tilt_y: tilt of the elipse around the center in Y axis in degrees.
- * @angle_tilt_z: tilt of the elipse around the center in Z axis in degrees.
- *
- * Sets the angles at which the ellipse should be tilted around it's center.
- *
- * Since: 0.4
- */
-void
-clutter_behaviour_ellipse_set_tilt (ClutterBehaviourEllipse *self,
- gdouble angle_tilt_x,
- gdouble angle_tilt_y,
- gdouble angle_tilt_z)
-{
- ClutterBehaviourEllipsePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
-
- priv = self->priv;
-
- g_object_freeze_notify (G_OBJECT (self));
-
- if (priv->angle_tilt_x != angle_tilt_x)
- {
- priv->angle_tilt_x = angle_tilt_x;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_TILT_X]);
- }
-
- if (priv->angle_tilt_y != angle_tilt_y)
- {
- priv->angle_tilt_y = angle_tilt_y;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_TILT_Y]);
- }
-
- if (priv->angle_tilt_z != angle_tilt_z)
- {
- priv->angle_tilt_z = angle_tilt_z;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_TILT_Z]);
- }
-
- g_object_thaw_notify (G_OBJECT (self));
-}
-
-/**
- * clutter_behaviour_ellipse_get_tilt:
- * @self: a #ClutterBehaviourEllipse
- * @angle_tilt_x: (out): return location for tilt angle on the X axis, or %NULL.
- * @angle_tilt_y: (out): return location for tilt angle on the Y axis, or %NULL.
- * @angle_tilt_z: (out): return location for tilt angle on the Z axis, or %NULL.
- *
- * Gets the tilt of the ellipse around the center in Y axis.
- *
- * Since: 0.4
- */
-void
-clutter_behaviour_ellipse_get_tilt (ClutterBehaviourEllipse *self,
- gdouble *angle_tilt_x,
- gdouble *angle_tilt_y,
- gdouble *angle_tilt_z)
-{
- ClutterBehaviourEllipsePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
-
- priv = self->priv;
-
- if (angle_tilt_x)
- *angle_tilt_x = priv->angle_tilt_x;
-
- if (angle_tilt_y)
- *angle_tilt_y = priv->angle_tilt_y;
-
- if (angle_tilt_z)
- *angle_tilt_z = priv->angle_tilt_z;
-}
-
-/**
- * clutter_behaviour_ellipse_get_direction:
- * @self: a #ClutterBehaviourEllipse
- *
- * Retrieves the #ClutterRotateDirection used by the ellipse behaviour.
- *
- * Return value: the rotation direction
- *
- * Since: 0.4
- */
-ClutterRotateDirection
-clutter_behaviour_ellipse_get_direction (ClutterBehaviourEllipse *self)
-{
- g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self),
- CLUTTER_ROTATE_CW);
-
- return self->priv->direction;
-}
-
-/**
- * clutter_behaviour_ellipse_set_direction:
- * @self: a #ClutterBehaviourEllipse
- * @direction: the rotation direction
- *
- * Sets the rotation direction used by the ellipse behaviour.
- *
- * Since: 0.4
- */
-void
-clutter_behaviour_ellipse_set_direction (ClutterBehaviourEllipse *self,
- ClutterRotateDirection direction)
-{
- ClutterBehaviourEllipsePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
-
- priv = self->priv;
-
- if (priv->direction != direction)
- {
- priv->direction = direction;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_DIRECTION]);
- }
-}
diff --git a/clutter/clutter-behaviour-ellipse.h b/clutter/clutter-behaviour-ellipse.h
deleted file mode 100644
index 302d4f200..000000000
--- a/clutter/clutter-behaviour-ellipse.h
+++ /dev/null
@@ -1,147 +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-alpha.h>
-#include <clutter/clutter-actor.h>
-#include <clutter/clutter-behaviour.h>
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
-
-#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
- *
- * Since: 0.4
- *
- * Deprecated: 1.6
- */
-struct _ClutterBehaviourEllipse
-{
- /*< private >*/
- ClutterBehaviour parent_instance;
- ClutterBehaviourEllipsePrivate *priv;
-};
-
-/**
- * ClutterBehaviourEllipseClass:
- *
- * The #ClutterBehaviourEllipseClass struct contains only private data
- *
- * Since: 0.4
- *
- * Deprecated: 1.6
- */
-struct _ClutterBehaviourEllipseClass
-{
- /*< private >*/
- ClutterBehaviourClass parent_class;
-};
-
-GType clutter_behaviour_ellipse_get_type (void) G_GNUC_CONST;
-
-ClutterBehaviour * clutter_behaviour_ellipse_new (ClutterAlpha *alpha,
- gint x,
- gint y,
- gint width,
- gint height,
- ClutterRotateDirection direction,
- gdouble start,
- gdouble end);
-void clutter_behaviour_ellipse_set_center (ClutterBehaviourEllipse *self,
- gint x,
- gint y);
-void clutter_behaviour_ellipse_get_center (ClutterBehaviourEllipse *self,
- gint *x,
- gint *y);
-void clutter_behaviour_ellipse_set_width (ClutterBehaviourEllipse *self,
- gint width);
-gint clutter_behaviour_ellipse_get_width (ClutterBehaviourEllipse *self);
-void clutter_behaviour_ellipse_set_height (ClutterBehaviourEllipse *self,
- gint height);
-gint clutter_behaviour_ellipse_get_height (ClutterBehaviourEllipse *self);
-void clutter_behaviour_ellipse_set_angle_start (ClutterBehaviourEllipse *self,
- gdouble angle_start);
-gdouble clutter_behaviour_ellipse_get_angle_start (ClutterBehaviourEllipse *self);
-void clutter_behaviour_ellipse_set_angle_end (ClutterBehaviourEllipse *self,
- gdouble angle_end);
-gdouble clutter_behaviour_ellipse_get_angle_end (ClutterBehaviourEllipse *self);
-void clutter_behaviour_ellipse_set_angle_tilt (ClutterBehaviourEllipse *self,
- ClutterRotateAxis axis,
- gdouble angle_tilt);
-gdouble clutter_behaviour_ellipse_get_angle_tilt (ClutterBehaviourEllipse *self,
- ClutterRotateAxis axis);
-void clutter_behaviour_ellipse_set_tilt (ClutterBehaviourEllipse *self,
- gdouble angle_tilt_x,
- gdouble angle_tilt_y,
- gdouble angle_tilt_z);
-void clutter_behaviour_ellipse_get_tilt (ClutterBehaviourEllipse *self,
- gdouble *angle_tilt_x,
- gdouble *angle_tilt_y,
- gdouble *angle_tilt_z);
-ClutterRotateDirection clutter_behaviour_ellipse_get_direction (ClutterBehaviourEllipse *self);
-void clutter_behaviour_ellipse_set_direction (ClutterBehaviourEllipse *self,
- ClutterRotateDirection direction);
-
-#endif /* CLUTTER_DISABLE_DEPRECATED */
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BEHAVIOUR_ELLIPSE_H__ */
diff --git a/clutter/clutter-behaviour-opacity.c b/clutter/clutter-behaviour-opacity.c
deleted file mode 100644
index 91dbb6b5a..000000000
--- a/clutter/clutter-behaviour-opacity.c
+++ /dev/null
@@ -1,319 +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.
- *
- * Since: 0.2
- *
- * 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>
-
-#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 (BEHAVIOUR, "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.
- *
- * Since: 0.2
- *
- * 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.
- *
- * Since: 0.2
- *
- * 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
- *
- * Since: 0.2
- *
- * 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.
- *
- * Since: 0.6
- *
- * 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.
- *
- * Since: 0.6
- *
- * 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;
-}
diff --git a/clutter/clutter-behaviour-opacity.h b/clutter/clutter-behaviour-opacity.h
deleted file mode 100644
index aa38ddb9b..000000000
--- a/clutter/clutter-behaviour-opacity.h
+++ /dev/null
@@ -1,116 +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-alpha.h>
-#include <clutter/clutter-behaviour.h>
-
-G_BEGIN_DECLS
-
-#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
-
-#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
- *
- * Since: 0.2
- *
- * 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
- *
- * Since: 0.2
- *
- * Deprecated: 1.6
- */
-struct _ClutterBehaviourOpacityClass
-{
- /*< private >*/
- ClutterBehaviourClass parent_class;
-};
-
-GType clutter_behaviour_opacity_get_type (void) G_GNUC_CONST;
-
-ClutterBehaviour *clutter_behaviour_opacity_new (ClutterAlpha *alpha,
- guint8 opacity_start,
- guint8 opacity_end);
-
-void clutter_behaviour_opacity_set_bounds (ClutterBehaviourOpacity *behaviour,
- guint8 opacity_start,
- guint8 opacity_end);
-void clutter_behaviour_opacity_get_bounds (ClutterBehaviourOpacity *behaviour,
- guint8 *opacity_start,
- guint8 *opacity_end);
-
-#endif /* CLUTTER_DISABLE_DEPRECATED */
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BEHAVIOUR_OPACITY_H__ */
diff --git a/clutter/clutter-behaviour-path.c b/clutter/clutter-behaviour-path.c
deleted file mode 100644
index f283928ca..000000000
--- a/clutter/clutter-behaviour-path.c
+++ /dev/null
@@ -1,474 +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
-
-#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 (BEHAVIOUR, "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.
- *
- * Since: 0.2
- *
- * 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
- *
- * Since: 0.2
- *
- * 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
- *
- * Since: 1.0
- *
- * 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: 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
- *
- * Since: 1.0
- *
- * 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.
- *
- * Since: 1.0
- *
- * 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
- *
- * Since: 1.0
- *
- * 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;
-}
diff --git a/clutter/clutter-behaviour-path.h b/clutter/clutter-behaviour-path.h
deleted file mode 100644
index 731aebddf..000000000
--- a/clutter/clutter-behaviour-path.h
+++ /dev/null
@@ -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-alpha.h>
-#include <clutter/clutter-behaviour.h>
-#include <clutter/clutter-path.h>
-
-G_BEGIN_DECLS
-
-#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
-
-#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
- *
- * Since: 0.2
- *
- * 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
- *
- * Since: 0.2
- *
- * 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);
-};
-
-GType clutter_behaviour_path_get_type (void) G_GNUC_CONST;
-
-ClutterBehaviour *clutter_behaviour_path_new (ClutterAlpha *alpha,
- ClutterPath *path);
-
-ClutterBehaviour *clutter_behaviour_path_new_with_description
- (ClutterAlpha *alpha,
- const gchar *desc);
-
-ClutterBehaviour *clutter_behaviour_path_new_with_knots
- (ClutterAlpha *alpha,
- const ClutterKnot *knots,
- guint n_knots);
-
-void clutter_behaviour_path_set_path (ClutterBehaviourPath *pathb,
- ClutterPath *path);
-
-ClutterPath * clutter_behaviour_path_get_path (ClutterBehaviourPath *pathb);
-
-#endif /* CLUTTER_DISABLE_DEPRECATED */
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BEHAVIOUR_PATH_H__ */
diff --git a/clutter/clutter-behaviour-rotate.c b/clutter/clutter-behaviour-rotate.c
deleted file mode 100644
index 40ede6bcd..000000000
--- a/clutter/clutter-behaviour-rotate.c
+++ /dev/null
@@ -1,693 +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 "clutter-behaviour-rotate.h"
-
-#include <math.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.
- *
- * Since: 0.4
- */
- 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.
- *
- * Since: 0.4
- */
- 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.
- *
- * Since: 0.4
- */
- 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.
- *
- * Since: 0.4
- */
- 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.
- *
- * Since: 0.4
- */
- 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.
- *
- * Since: 0.4
- */
- 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.
- *
- * Since: 0.4
- */
- 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.
- *
- * Since: 0.4
- */
-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
- *
- * Since: 0.4
- */
-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.
- *
- * Since: 0.4
- */
-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
- *
- * Since: 0.4
- */
-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.
- *
- * Since: 0.4
- */
-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: return value for the initial angle
- * @angle_end: return value for the final angle
- *
- * Retrieves the rotation boundaries of the rotate behaviour.
- *
- * Since: 0.4
- */
-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).
- *
- * Since: 0.4
- */
-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().
- *
- * Since: 0.4
- */
-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().
- *
- * Since: 0.4
- */
-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;
-}
diff --git a/clutter/clutter-behaviour-rotate.h b/clutter/clutter-behaviour-rotate.h
deleted file mode 100644
index c30aef9b5..000000000
--- a/clutter/clutter-behaviour-rotate.h
+++ /dev/null
@@ -1,115 +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-alpha.h>
-#include <clutter/clutter-behaviour.h>
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
-
-#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
- *
- * Since: 0.4
- *
- * Deprecated: 1.6: Use clutter_actor_animate() instead.
- */
-struct _ClutterBehaviourRotate
-{
- /*< private >*/
- ClutterBehaviour parent_instance;
-
- ClutterBehaviourRotatePrivate *priv;
-};
-
-/**
- * ClutterBehaviourRotateClass:
- *
- * The #ClutterBehaviourRotateClass struct contains only private data
- *
- * Since: 0.4
- *
- * Deprecated: 1.6
- */
-struct _ClutterBehaviourRotateClass
-{
- /*< private >*/
- ClutterBehaviourClass parent_class;
-};
-
-GType clutter_behaviour_rotate_get_type (void) G_GNUC_CONST;
-
-ClutterBehaviour * clutter_behaviour_rotate_new (ClutterAlpha *alpha,
- ClutterRotateAxis axis,
- ClutterRotateDirection direction,
- gdouble angle_start,
- gdouble angle_end);
-void clutter_behaviour_rotate_get_center (ClutterBehaviourRotate *rotate,
- gint *x,
- gint *y,
- gint *z);
-void clutter_behaviour_rotate_set_center (ClutterBehaviourRotate *rotate,
- gint x,
- gint y,
- gint z);
-ClutterRotateAxis clutter_behaviour_rotate_get_axis (ClutterBehaviourRotate *rotate);
-void clutter_behaviour_rotate_set_axis (ClutterBehaviourRotate *rotate,
- ClutterRotateAxis axis);
-ClutterRotateDirection clutter_behaviour_rotate_get_direction (ClutterBehaviourRotate *rotate);
-void clutter_behaviour_rotate_set_direction (ClutterBehaviourRotate *rotate,
- ClutterRotateDirection direction);
-void clutter_behaviour_rotate_get_bounds (ClutterBehaviourRotate *rotate,
- gdouble *angle_start,
- gdouble *angle_end);
-void clutter_behaviour_rotate_set_bounds (ClutterBehaviourRotate *rotate,
- gdouble angle_start,
- gdouble angle_end);
-
-#endif /* CLUTTER_DISABLE_DEPRECATED */
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BEHAVIOUR_ROTATE_H__ */
diff --git a/clutter/clutter-behaviour-scale.c b/clutter/clutter-behaviour-scale.c
deleted file mode 100644
index 337a4902b..000000000
--- a/clutter/clutter-behaviour-scale.c
+++ /dev/null
@@ -1,439 +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>
-
-#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.
- *
- * Since: 0.6
- *
- * 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.
- *
- * Since: 0.6
- *
- * 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.
- *
- * Since: 0.6
- *
- * 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.
- *
- * Since: 0.6
- *
- * 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
- *
- * Since: 0.2
- *
- * 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.
- *
- * Since: 0.6
- *
- * 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.
- *
- * Since: 0.4
- *
- * 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;
-}
diff --git a/clutter/clutter-behaviour-scale.h b/clutter/clutter-behaviour-scale.h
deleted file mode 100644
index 3671cabf0..000000000
--- a/clutter/clutter-behaviour-scale.h
+++ /dev/null
@@ -1,106 +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-behaviour.h>
-
-G_BEGIN_DECLS
-
-#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
-
-#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
- *
- * Since: 0.2
- *
- * Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:x-scale
- * and #ClutterActor:y-scale instead.
- */
-struct _ClutterBehaviourScale
-{
- /*< private >*/
- ClutterBehaviour parent_instance;
-
- ClutterBehaviourScalePrivate *priv;
-};
-
-/**
- * ClutterBehaviourScaleClass:
- *
- * The #ClutterBehaviourScaleClass struct contains only private data
- *
- * Since: 0.2
- *
- * Deprecated: 1.6
- */
-struct _ClutterBehaviourScaleClass
-{
- /*< private >*/
- ClutterBehaviourClass parent_class;
-};
-
-GType clutter_behaviour_scale_get_type (void) G_GNUC_CONST;
-
-ClutterBehaviour *clutter_behaviour_scale_new (ClutterAlpha *alpha,
- gdouble x_scale_start,
- gdouble y_scale_start,
- gdouble x_scale_end,
- gdouble y_scale_end);
-void clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
- gdouble x_scale_start,
- gdouble y_scale_start,
- gdouble x_scale_end,
- gdouble y_scale_end);
-void clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
- gdouble *x_scale_start,
- gdouble *y_scale_start,
- gdouble *x_scale_end,
- gdouble *y_scale_end);
-
-#endif /* CLUTTER_DISABLE_DEPRECATED */
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BEHAVIOUR_SCALE_H__ */
diff --git a/clutter/clutter-behaviour.c b/clutter/clutter-behaviour.c
deleted file mode 100644
index 9f238fe7c..000000000
--- a/clutter/clutter-behaviour.c
+++ /dev/null
@@ -1,708 +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
-
-#include "clutter-behaviour.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"
-
-/**
- * clutter_knot_copy:
- * @knot: a #ClutterKnot
- *
- * Makes an allocated copy of a knot.
- *
- * Return value: the copied knot.
- *
- * Since: 0.2
- */
-ClutterKnot *
-clutter_knot_copy (const ClutterKnot *knot)
-{
- ClutterKnot *copy;
-
- copy = g_slice_new0 (ClutterKnot);
-
- *copy = *knot;
-
- return copy;
-}
-
-/**
- * clutter_knot_free:
- * @knot: a #ClutterKnot
- *
- * Frees the memory of an allocated knot.
- *
- * Since: 0.2
- */
-void
-clutter_knot_free (ClutterKnot *knot)
-{
- if (G_LIKELY (knot))
- {
- g_slice_free (ClutterKnot, knot);
- }
-}
-
-/**
- * clutter_knot_equal:
- * @knot_a: First knot
- * @knot_b: Second knot
- *
- * Compares to knot and checks if the point to the same location.
- *
- * Return value: %TRUE if the knots point to the same location.
- *
- * Since: 0.2
- */
-gboolean
-clutter_knot_equal (const ClutterKnot *knot_a,
- const ClutterKnot *knot_b)
-{
- g_return_val_if_fail (knot_a != NULL, FALSE);
- g_return_val_if_fail (knot_b != NULL, FALSE);
-
- if (knot_a == knot_b)
- return TRUE;
-
- return knot_a->x == knot_b->x && knot_a->y == knot_b->y;
-}
-
-G_DEFINE_BOXED_TYPE (ClutterKnot, clutter_knot,
- clutter_knot_copy,
- clutter_knot_free);
-
-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.
- *
- * Since: 0.2
- */
- 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.
- *
- * Since: 0.4
- */
- 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.
- *
- * Since: 0.4
- */
- 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.
- *
- * Since: 0.2
- */
-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.
- *
- * Since: 0.4
- */
-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.
- *
- * Since: 0.2
- */
-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
- *
- * Since: 0.2
- */
-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.
- *
- * Since: 0.2
- */
-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.
- *
- * Since: 0.2
- */
-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.
- *
- * Since: 0.2
- */
-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 (BEHAVIOUR, "notify::alpha");
-
- /* no actors, we can stop right here */
- if (behave->priv->actors == NULL)
- return;
-
- if (klass->alpha_notify)
- {
- gdouble alpha_value = clutter_alpha_get_alpha (behave->priv->alpha);
-
- CLUTTER_NOTE (BEHAVIOUR, "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.
- *
- * Since: 0.2
- */
-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 (BEHAVIOUR, "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 (BEHAVIOUR, "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 (BEHAVIOUR, "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.
- *
- * Since: 0.2
- */
-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.
- *
- * Since: 0.4
- */
-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;
-}
diff --git a/clutter/clutter-behaviour.h b/clutter/clutter-behaviour.h
deleted file mode 100644
index 7f7ddf0b3..000000000
--- a/clutter/clutter-behaviour.h
+++ /dev/null
@@ -1,166 +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 <glib-object.h>
-#include <clutter/clutter-alpha.h>
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
-
-#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 _ClutterBehaviour ClutterBehaviour;
-typedef struct _ClutterBehaviourPrivate ClutterBehaviourPrivate;
-typedef struct _ClutterBehaviourClass ClutterBehaviourClass;
-
-/**
- * ClutterBehaviourForeachFunc:
- * @behaviour: the #ClutterBehaviour
- * @actor: an actor driven by @behaviour
- * @data: 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.
- *
- * Since: 0.2
- *
- * 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.
- *
- * Since: 0.2
- *
- * 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.
- *
- * Since: 0.2
- *
- * 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);
-};
-
-GType clutter_behaviour_get_type (void) G_GNUC_CONST;
-
-void clutter_behaviour_apply (ClutterBehaviour *behave,
- ClutterActor *actor);
-void clutter_behaviour_remove (ClutterBehaviour *behave,
- ClutterActor *actor);
-void clutter_behaviour_remove_all (ClutterBehaviour *behave);
-void clutter_behaviour_actors_foreach (ClutterBehaviour *behave,
- ClutterBehaviourForeachFunc func,
- gpointer data);
-gint clutter_behaviour_get_n_actors (ClutterBehaviour *behave);
-ClutterActor *clutter_behaviour_get_nth_actor (ClutterBehaviour *behave,
- gint index_);
-GSList * clutter_behaviour_get_actors (ClutterBehaviour *behave);
-ClutterAlpha *clutter_behaviour_get_alpha (ClutterBehaviour *behave);
-void clutter_behaviour_set_alpha (ClutterBehaviour *behave,
- ClutterAlpha *alpha);
-gboolean clutter_behaviour_is_applied (ClutterBehaviour *behave,
- ClutterActor *actor);
-
-#endif /* !CLUTTER_DISABLE_DEPRECATED || CLUTTER_COMPILATION */
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BEHAVIOUR_H__ */
diff --git a/clutter/clutter-path.c b/clutter/clutter-path.c
index 91b2be2ff..82d41fbe2 100644
--- a/clutter/clutter-path.c
+++ b/clutter/clutter-path.c
@@ -146,6 +146,10 @@ G_DEFINE_BOXED_TYPE (ClutterPathNode, clutter_path_node,
clutter_path_node_copy,
clutter_path_node_free);
+G_DEFINE_BOXED_TYPE (ClutterKnot, clutter_knot,
+ clutter_knot_copy,
+ clutter_knot_free);
+
G_DEFINE_TYPE_WITH_CODE (ClutterPath,
clutter_path,
G_TYPE_INITIALLY_UNOWNED,
@@ -1496,6 +1500,64 @@ clutter_path_get_length (ClutterPath *path)
return path->priv->total_length;
}
+/**
+ * clutter_knot_copy:
+ * @knot: a #ClutterKnot
+ *
+ * Makes an allocated copy of a knot.
+ *
+ * Return value: the copied knot.
+ *
+ * Since: 0.2
+ */
+ClutterKnot *
+clutter_knot_copy (const ClutterKnot *knot)
+{
+ if (knot != NULL)
+ return g_slice_dup (ClutterKnot, knot);
+
+ return NULL;
+}
+
+/**
+ * clutter_knot_free:
+ * @knot: a #ClutterKnot
+ *
+ * Frees the memory of an allocated knot.
+ *
+ * Since: 0.2
+ */
+void
+clutter_knot_free (ClutterKnot *knot)
+{
+ if (knot != NULL)
+ g_slice_free (ClutterKnot, knot);
+}
+
+/**
+ * clutter_knot_equal:
+ * @knot_a: First knot
+ * @knot_b: Second knot
+ *
+ * Compares to knot and checks if the point to the same location.
+ *
+ * Return value: %TRUE if the knots point to the same location.
+ *
+ * Since: 0.2
+ */
+gboolean
+clutter_knot_equal (const ClutterKnot *knot_a,
+ const ClutterKnot *knot_b)
+{
+ g_return_val_if_fail (knot_a != NULL, FALSE);
+ g_return_val_if_fail (knot_b != NULL, FALSE);
+
+ if (knot_a == knot_b)
+ return TRUE;
+
+ return knot_a->x == knot_b->x && knot_a->y == knot_b->y;
+}
+
static ClutterPathNodeFull *
clutter_path_node_full_new (void)
{
diff --git a/clutter/clutter-script.c b/clutter/clutter-script.c
index b3625c037..0850bb9f2 100644
--- a/clutter/clutter-script.c
+++ b/clutter/clutter-script.c
@@ -236,7 +236,6 @@
#include "clutter-actor.h"
#include "clutter-alpha.h"
-#include "clutter-behaviour.h"
#include "clutter-container.h"
#include "clutter-stage.h"
#include "clutter-state.h"
diff --git a/clutter/clutter.h b/clutter/clutter.h
index bd2ccd0fd..eadad21a2 100644
--- a/clutter/clutter.h
+++ b/clutter/clutter.h
@@ -41,13 +41,6 @@
#include "clutter-animation.h"
#include "clutter-animator.h"
#include "clutter-backend.h"
-#include "clutter-behaviour-depth.h"
-#include "clutter-behaviour-ellipse.h"
-#include "clutter-behaviour.h"
-#include "clutter-behaviour-opacity.h"
-#include "clutter-behaviour-path.h"
-#include "clutter-behaviour-rotate.h"
-#include "clutter-behaviour-scale.h"
#include "clutter-bind-constraint.h"
#include "clutter-binding-pool.h"
#include "clutter-bin-layout.h"
diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am
index 0a57ad0d6..d2b171144 100644
--- a/tests/conform/Makefile.am
+++ b/tests/conform/Makefile.am
@@ -17,7 +17,6 @@ units_sources =
# animation tests
units_sources += \
test-animator.c \
- test-behaviours.c \
test-score.c \
test-state.c \
test-timeline.c \
diff --git a/tests/conform/test-behaviours.c b/tests/conform/test-behaviours.c
deleted file mode 100644
index 7df5e131e..000000000
--- a/tests/conform/test-behaviours.c
+++ /dev/null
@@ -1,92 +0,0 @@
-#include <glib.h>
-
-#undef CLUTTER_DISABLE_DEPRECATED
-#include <clutter/clutter.h>
-
-#include "test-conform-common.h"
-
-typedef struct _BehaviourFixture BehaviourFixture;
-
-typedef void (* BehaviourTestFunc) (BehaviourFixture *fixture);
-
-struct _BehaviourFixture
-{
- ClutterTimeline *timeline;
- ClutterAlpha *alpha;
- ClutterActor *rect;
-};
-
-static void
-opacity_behaviour (BehaviourFixture *fixture)
-{
- ClutterBehaviour *behaviour;
- guint8 start, end;
- guint starti;
-
- behaviour = clutter_behaviour_opacity_new (fixture->alpha, 0, 255);
- g_assert (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour));
-
- clutter_behaviour_opacity_get_bounds (CLUTTER_BEHAVIOUR_OPACITY (behaviour),
- &start,
- &end);
-
- if (g_test_verbose ())
- g_print ("BehaviourOpacity:bounds = %d, %d (expected: 0, 255)\n",
- start,
- end);
-
- g_assert_cmpint (start, ==, 0);
- g_assert_cmpint (end, ==, 255);
-
- clutter_behaviour_opacity_set_bounds (CLUTTER_BEHAVIOUR_OPACITY (behaviour),
- 255,
- 0);
- /* XXX: The gobject property is actually a unsigned int not unsigned char
- * property so we have to be careful not to corrupt the stack by passing
- * a guint8 pointer here... */
- starti = 0;
- g_object_get (G_OBJECT (behaviour), "opacity-start", &starti, NULL);
-
- if (g_test_verbose ())
- g_print ("BehaviourOpacity:start = %d (expected: 255)\n", start);
-
- g_assert_cmpint (starti, ==, 255);
-
- g_object_unref (behaviour);
-}
-
-static const struct
-{
- const gchar *desc;
- BehaviourTestFunc func;
-} behaviour_tests[] = {
- { "BehaviourOpacity", opacity_behaviour }
-};
-
-static const gint n_behaviour_tests = G_N_ELEMENTS (behaviour_tests);
-
-void
-test_behaviours (TestConformSimpleFixture *fixture,
- gconstpointer dummy)
-{
- BehaviourFixture b_fixture;
- gint i;
-
- b_fixture.timeline = clutter_timeline_new (1000);
- b_fixture.alpha = clutter_alpha_new_full (b_fixture.timeline, CLUTTER_LINEAR);
- b_fixture.rect = clutter_rectangle_new ();
-
- g_object_ref_sink (b_fixture.alpha);
- g_object_unref (b_fixture.timeline);
-
- for (i = 0; i < n_behaviour_tests; i++)
- {
- if (g_test_verbose ())
- g_print ("Testing: %s\n", behaviour_tests[i].desc);
-
- behaviour_tests[i].func (&b_fixture);
- }
-
- g_object_unref (b_fixture.alpha);
- clutter_actor_destroy (b_fixture.rect);
-}
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index 1cc7d5d36..f1eda71fa 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -192,7 +192,6 @@ main (int argc, char **argv)
TEST_CONFORM_SIMPLE ("/script", test_script_single);
TEST_CONFORM_SIMPLE ("/script", test_script_child);
- TEST_CONFORM_SIMPLE ("/script", test_script_implicit_alpha);
TEST_CONFORM_SIMPLE ("/script", test_script_object_property);
TEST_CONFORM_SIMPLE ("/script", test_script_animation);
TEST_CONFORM_SIMPLE ("/script", test_script_named_object);
@@ -208,8 +207,6 @@ main (int argc, char **argv)
TEST_CONFORM_SIMPLE ("/score", test_score);
- TEST_CONFORM_SIMPLE ("/behaviours", test_behaviours);
-
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_object);
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_fixed);
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_backface_culling);
diff --git a/tests/conform/test-script-parser.c b/tests/conform/test-script-parser.c
index 44abe09cd..cc6b9a38e 100644
--- a/tests/conform/test-script-parser.c
+++ b/tests/conform/test-script-parser.c
@@ -205,45 +205,6 @@ test_script_single (TestConformSimpleFixture *fixture,
}
void
-test_script_implicit_alpha (TestConformSimpleFixture *fixture,
- gconstpointer dummy)
-{
- ClutterScript *script = clutter_script_new ();
- ClutterTimeline *timeline;
- GObject *behaviour = NULL;
- GError *error = NULL;
- ClutterAlpha *alpha;
- gchar *test_file;
-
- test_file = clutter_test_get_data_file ("test-script-implicit-alpha.json");
- clutter_script_load_from_file (script, test_file, &error);
- if (g_test_verbose () && error)
- g_print ("Error: %s", error->message);
-
-#if GLIB_CHECK_VERSION (2, 20, 0)
- g_assert_no_error (error);
-#else
- g_assert (error == NULL);
-#endif
-
- behaviour = clutter_script_get_object (script, "test");
- g_assert (CLUTTER_IS_BEHAVIOUR (behaviour));
-
- alpha = clutter_behaviour_get_alpha (CLUTTER_BEHAVIOUR (behaviour));
- g_assert (CLUTTER_IS_ALPHA (alpha));
-
- g_assert_cmpint (clutter_alpha_get_mode (alpha), ==, CLUTTER_EASE_OUT_CIRC);
-
- timeline = clutter_alpha_get_timeline (alpha);
- g_assert (CLUTTER_IS_TIMELINE (timeline));
-
- g_assert_cmpint (clutter_timeline_get_duration (timeline), ==, 500);
-
- g_object_unref (script);
- g_free (test_file);
-}
-
-void
test_script_object_property (TestConformSimpleFixture *fixture,
gconstpointer dummy)
{
diff --git a/tests/data/test-script.json b/tests/data/test-script.json
index 3482d734b..20c584662 100644
--- a/tests/data/test-script.json
+++ b/tests/data/test-script.json
@@ -17,8 +17,7 @@
"reactive" : true,
"rotation" : [
{ "z-axis" : [ 45.0, [ 75, 75 ] ] }
- ],
- "behaviours" : [ "fade-behaviour", "path-behaviour" ]
+ ]
},
{
"id" : "green-button",
@@ -46,8 +45,7 @@
"keep-aspect-ratio" : true,
"anchor-x" : "5 em",
"anchor-y" : "5 pt",
- "opacity" : 100,
- "behaviours" : [ "rotate-behaviour", "fade-behaviour" ]
+ "opacity" : 100
},
{
"id" : "red-hand-clone",
diff --git a/tests/interactive/Makefile.am b/tests/interactive/Makefile.am
index 67ed9a7b8..c59094b7f 100644
--- a/tests/interactive/Makefile.am
+++ b/tests/interactive/Makefile.am
@@ -5,13 +5,7 @@ UNIT_TESTS = \
test-texture-async.c \
test-texture-material.c \
test-events.c \
- test-scale.c \
- test-actors.c \
- test-actor-clone.c \
- test-behave.c \
test-shader-effects.c \
- test-depth.c \
- test-threads.c \
test-script.c \
test-model.c \
test-grab.c \
@@ -23,7 +17,6 @@ UNIT_TESTS = \
test-state-animator.c \
test-unproject.c \
test-fbo.c \
- test-multistage.c \
test-cogl-primitives.c \
test-cogl-tex-tile.c \
test-cogl-tex-convert.c \
@@ -34,8 +27,6 @@ UNIT_TESTS = \
test-cogl-multitexture.c \
test-stage-read-pixels.c \
test-clip.c \
- test-paint-wrapper.c \
- test-texture-quality.c \
test-layout.c \
test-animation.c \
test-easing.c \
@@ -60,7 +51,7 @@ UNIT_TESTS = \
test-drop.c
if X11_TESTS
-UNIT_TESTS += test-pixmap.c test-devices.c
+UNIT_TESTS += test-devices.c
endif
if OS_WIN32
diff --git a/tests/interactive/test-behave.c b/tests/interactive/test-behave.c
deleted file mode 100644
index 0ec4e1e07..000000000
--- a/tests/interactive/test-behave.c
+++ /dev/null
@@ -1,213 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-#include <gmodule.h>
-
-#undef CLUTTER_DISABLE_DEPRECATED
-#include <clutter/clutter.h>
-
-static gboolean
-button_press_cb (ClutterStage *stage,
- ClutterButtonEvent *event,
- gpointer data)
-{
- const gchar *click_type;
-
- switch (event->click_count)
- {
- case 2:
- click_type = "double";
- break;
- case 3:
- click_type = "triple";
- break;
- default:
- click_type = "single";
- break;
- }
-
- g_print ("%s button press event\n", click_type);
-
- return FALSE;
-}
-
-static gboolean
-scroll_event_cb (ClutterStage *stage,
- ClutterScrollEvent *event,
- gpointer data)
-{
- g_print ("scroll direction: %s\n",
- event->direction == CLUTTER_SCROLL_UP ? "up"
- : "down");
-
- return FALSE;
-}
-
-typedef enum {
- PATH_POLY,
- PATH_ELLIPSE,
- PATH_BSPLINE
-} path_t;
-
-G_MODULE_EXPORT int
-test_behave_main (int argc, char *argv[])
-{
- ClutterTimeline *timeline;
- ClutterAlpha *alpha;
- ClutterBehaviour *o_behave, *p_behave;
- ClutterActor *stage;
- ClutterActor *group, *rect, *hand;
- gchar *file;
- int i;
- path_t path_type = PATH_POLY;
-
- const char *knots_poly = ("M 0, 0 L 0, 300 L 300, 300 "
- "L 300, 0 L 0, 0");
-
- /* A spiral created with inkscake */
- const char *knots_bspline =
- "M 34.285713,35.219326 "
- "C 44.026891,43.384723 28.084874,52.378758 20.714286,51.409804 "
- "C 0.7404474,48.783999 -4.6171866,23.967448 1.904757,8.0764719 "
- "C 13.570984,-20.348756 49.798303,-26.746504 74.999994,-13.352108 "
- "C 111.98449,6.3047056 119.56591,55.259271 99.047626,89.505034 "
- "C 71.699974,135.14925 9.6251774,143.91924 -33.571422,116.17172 "
- "C -87.929934,81.254291 -97.88804,5.8941057 -62.857155,-46.209236 "
- "C -20.430061,-109.31336 68.300385,-120.45954 129.2857,-78.114021 "
- "C 201.15479,-28.21129 213.48932,73.938876 163.80954,143.79074 "
- "C 106.45226,224.43749 -9.1490153,237.96076 -87.85713,180.93363 "
- "C -177.29029,116.13577 -192.00272,-12.937817 -127.61907,-100.49494 "
- "C -55.390344,-198.72081 87.170553,-214.62275 183.57141,-142.87593 "
- "C 290.59464,-63.223369 307.68641,92.835839 228.57145,198.07645";
-
- for (i = 0; i < argc; ++i)
- {
- if (!strncmp (argv[i], "--path", 6))
- {
- if (!strncmp (argv[i] + 7, "poly", 4))
- path_type = PATH_POLY;
- else if (!strncmp (argv[i] + 7, "bspline", 7))
- path_type = PATH_BSPLINE;
- else if (!strncmp (argv[i] + 7, "ellipse", 7))
- path_type = PATH_ELLIPSE;
- }
- else if (!strncmp (argv[i], "--help", 6))
- {
- printf ("behave [--path=poly|ellipse|bspline]\n");
- exit (0);
- }
- }
-
- if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
- return 1;
-
- stage = clutter_stage_new ();
- clutter_stage_set_title (CLUTTER_STAGE (stage), "Behaviours");
- clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Aluminium2);
- clutter_stage_hide_cursor (CLUTTER_STAGE (stage));
- g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
- g_signal_connect (stage, "button-press-event",
- G_CALLBACK (button_press_cb),
- NULL);
- g_signal_connect (stage, "scroll-event",
- G_CALLBACK (scroll_event_cb),
- NULL);
- g_signal_connect (stage, "key-press-event",
- G_CALLBACK (clutter_main_quit),
- NULL);
-
- /* Make a hand */
- group = clutter_group_new ();
- clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
- clutter_actor_show (group);
-
- file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
- hand = clutter_texture_new_from_file (file, NULL);
- if (hand == NULL)
- g_error("Unable to load '%s'", file);
-
- g_free (file);
-
- clutter_actor_set_position (hand, 0, 0);
- clutter_actor_show (hand);
-
- rect = clutter_rectangle_new ();
- clutter_actor_set_position (rect, 0, 0);
- clutter_actor_set_size (rect,
- clutter_actor_get_width (hand),
- clutter_actor_get_height (hand));
- clutter_rectangle_set_color (CLUTTER_RECTANGLE (rect), CLUTTER_COLOR_Transparent);
- clutter_rectangle_set_border_width (CLUTTER_RECTANGLE (rect), 10);
- clutter_rectangle_set_border_color (CLUTTER_RECTANGLE (rect),
- CLUTTER_COLOR_Chameleon);
- clutter_actor_show (rect);
-
- clutter_container_add (CLUTTER_CONTAINER (group), rect, hand, NULL);
-
- /* Make a timeline */
- timeline = clutter_timeline_new (4000);
- clutter_timeline_set_loop (timeline, TRUE);
- clutter_timeline_set_auto_reverse (timeline, TRUE);
-
- /* Set an alpha func to power behaviour - ramp is constant rise */
- alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
-
- /* Create a behaviour for that alpha */
- o_behave = clutter_behaviour_opacity_new (alpha, 0X33, 0xff);
-
- /* Apply it to our actor */
- clutter_behaviour_apply (o_behave, group);
-
- /* Make a path behaviour and apply that too */
- switch (path_type)
- {
- case PATH_POLY:
- {
- ClutterPath *path = clutter_path_new ();
- clutter_path_set_description (path, knots_poly);
- p_behave = clutter_behaviour_path_new (alpha, path);
- }
- break;
- case PATH_ELLIPSE:
- p_behave =
- clutter_behaviour_ellipse_new (alpha, 200, 200, 400, 300,
- CLUTTER_ROTATE_CW,
- 0.0, 360.0);
-
- clutter_behaviour_ellipse_set_angle_tilt (CLUTTER_BEHAVIOUR_ELLIPSE (p_behave),
- CLUTTER_X_AXIS,
- 45.0);
- clutter_behaviour_ellipse_set_angle_tilt (CLUTTER_BEHAVIOUR_ELLIPSE (p_behave),
- CLUTTER_Z_AXIS,
- 45.0);
- break;
-
- case PATH_BSPLINE:
- {
- ClutterPath *path = clutter_path_new ();
- clutter_path_set_description (path, knots_bspline);
- p_behave = clutter_behaviour_path_new (alpha, path);
- }
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-
- clutter_behaviour_apply (p_behave, group);
-
- /* start the timeline and thus the animations */
- clutter_timeline_start (timeline);
-
- clutter_actor_show_all (stage);
-
- clutter_main();
-
- g_object_unref (o_behave);
- g_object_unref (p_behave);
-
- return 0;
-}
diff --git a/tests/interactive/test-scale.c b/tests/interactive/test-scale.c
deleted file mode 100644
index 23a63542d..000000000
--- a/tests/interactive/test-scale.c
+++ /dev/null
@@ -1,117 +0,0 @@
-#include <stdlib.h>
-#include <gmodule.h>
-
-#undef CLUTTER_DISABLE_DEPRECATED
-#include <clutter/clutter.h>
-
-static const ClutterGravity gravities[] = {
- CLUTTER_GRAVITY_NORTH_EAST,
- CLUTTER_GRAVITY_NORTH,
- CLUTTER_GRAVITY_NORTH_WEST,
- CLUTTER_GRAVITY_WEST,
- CLUTTER_GRAVITY_SOUTH_WEST,
- CLUTTER_GRAVITY_SOUTH,
- CLUTTER_GRAVITY_SOUTH_EAST,
- CLUTTER_GRAVITY_EAST,
- CLUTTER_GRAVITY_CENTER,
- CLUTTER_GRAVITY_NONE
-};
-
-static gint gindex = 0;
-static ClutterActor *label;
-
-static void
-set_next_gravity (ClutterActor *actor)
-{
- ClutterGravity gravity = gravities[gindex];
- GEnumClass *eclass;
- GEnumValue *evalue;
-
- clutter_actor_move_anchor_point_from_gravity (actor, gravities[gindex]);
-
- eclass = g_type_class_ref (CLUTTER_TYPE_GRAVITY);
- evalue = g_enum_get_value (eclass, gravity);
- clutter_text_set_text (CLUTTER_TEXT (label), evalue->value_nick);
- g_type_class_unref (eclass);
-
- if (++gindex >= G_N_ELEMENTS (gravities))
- gindex = 0;
-}
-
-static gdouble
-my_ramp_func (ClutterAlpha *alpha,
- gpointer unused)
-{
- ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);
-
- return clutter_timeline_get_progress (timeline);
-}
-
-G_MODULE_EXPORT int
-test_scale_main (int argc, char *argv[])
-{
- ClutterActor *stage, *rect;
- ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
- ClutterColor rect_color = { 0xff, 0xff, 0xff, 0x99 };
- ClutterColor white_color = { 0xff, 0xff, 0xff, 0xFF };
- ClutterTimeline *timeline;
- ClutterAlpha *alpha;
- ClutterBehaviour *behave;
-
- if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
- return 1;
-
- stage = clutter_stage_get_default ();
-
- clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
- clutter_actor_set_size (stage, 300, 300);
-
- rect = clutter_rectangle_new_with_color (&rect_color);
- clutter_actor_set_size (rect, 100, 100);
- clutter_actor_set_position (rect, 100, 100);
-
- clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
-
- label = clutter_text_new_with_text ("Sans 20px", "");
- clutter_text_set_color (CLUTTER_TEXT (label),
- &white_color);
- clutter_actor_set_position (label,
- clutter_actor_get_x (rect),
- clutter_actor_get_y (rect)
- + clutter_actor_get_height (rect));
-
- clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);
-
- rect_color.alpha = 0xff;
- rect = clutter_rectangle_new_with_color (&rect_color);
- clutter_actor_set_position (rect, 100, 100);
- clutter_actor_set_size (rect, 100, 100);
- set_next_gravity (rect);
-
- clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
-
- timeline = clutter_timeline_new (750);
- alpha = clutter_alpha_new_with_func (timeline,
- my_ramp_func,
- NULL, NULL);
-
- behave = clutter_behaviour_scale_new (alpha,
- 0.0, 0.0, /* scale start */
- 1.0, 1.0); /* scale end */
-
- clutter_behaviour_apply (behave, rect);
-
- clutter_timeline_set_loop (timeline, TRUE);
- g_signal_connect_swapped (timeline, "completed",
- G_CALLBACK (set_next_gravity), rect);
- clutter_timeline_start (timeline);
-
- clutter_actor_show_all (stage);
-
- clutter_main();
-
- g_object_unref (timeline);
- g_object_unref (behave);
-
- return EXIT_SUCCESS;
-}
diff --git a/tests/interactive/test-script.c b/tests/interactive/test-script.c
index e98019697..d9c54dad3 100644
--- a/tests/interactive/test-script.c
+++ b/tests/interactive/test-script.c
@@ -32,73 +32,6 @@ static const gchar *test_unmerge =
" }"
"]";
-static const gchar *test_behaviour =
-"["
-" {"
-" \"id\" : \"main-timeline\","
-" \"type\" : \"ClutterTimeline\","
-" \"duration\" : 5000,"
-" \"loop\" : true"
-" },"
-" {"
-" \"id\" : \"sine-alpha\","
-" \"type\" : \"ClutterAlpha\","
-" \"function\" : \"sine_alpha\","
-" \"timeline\" : \"main-timeline\""
-" },"
-" {"
-" \"id\" : \"path-behaviour\","
-" \"type\" : \"ClutterBehaviourPath\","
-" \"path\" : \"M 50 50 L 100 100\","
-" \"alpha\" : {"
-" \"timeline\" : \"main-timeline\","
-" \"function\" : \"double_ramp_alpha\""
-" }"
-" },"
-" {"
-" \"id\" : \"rotate-behaviour\","
-" \"type\" : \"ClutterBehaviourRotate\","
-" \"angle-start\" : 0.0,"
-" \"angle-end\" : 360.0,"
-" \"axis\" : \"y-axis\","
-" \"alpha\" : \"sine-alpha\""
-" },"
-" {"
-" \"id\" : \"fade-behaviour\","
-" \"type\" : \"ClutterBehaviourOpacity\","
-" \"opacity-start\" : 255,"
-" \"opacity-end\" : 0,"
-" \"alpha\" : {"
-" \"id\" : \"fade-alpha\","
-" \"type\" : \"ClutterAlpha\","
-" \"timeline\" : \"main-timeline\","
-" \"mode\" : \"linear\""
-" }"
-" }"
-"]";
-
-gdouble
-sine_alpha (ClutterAlpha *alpha,
- gpointer dummy G_GNUC_UNUSED)
-{
- ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);
-
- return sin (clutter_timeline_get_progress (timeline) * G_PI);
-}
-
-gdouble
-double_ramp_alpha (ClutterAlpha *alpha,
- gpointer dummy G_GNUC_UNUSED)
-{
- ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);
- gdouble progress = clutter_timeline_get_progress (timeline);
-
- if (progress >= 0.5)
- return 1.0 - progress;
-
- return progress;
-}
-
static gboolean
blue_button_press (ClutterActor *actor,
ClutterButtonEvent *event,
@@ -117,18 +50,8 @@ red_button_press (ClutterActor *actor,
ClutterButtonEvent *event,
gpointer data)
{
- GObject *timeline;
-
g_print ("[*] Pressed '%s'\n", clutter_get_script_id (G_OBJECT (actor)));
- timeline = clutter_script_get_object (script, "main-timeline");
- g_assert (CLUTTER_IS_TIMELINE (timeline));
-
- if (!clutter_timeline_is_playing (CLUTTER_TIMELINE (timeline)))
- clutter_timeline_start (CLUTTER_TIMELINE (timeline));
- else
- clutter_timeline_pause (CLUTTER_TIMELINE (timeline));
-
return TRUE;
}
@@ -146,16 +69,6 @@ test_script_main (int argc, char *argv[])
script = clutter_script_new ();
g_assert (CLUTTER_IS_SCRIPT (script));
- clutter_script_load_from_data (script, test_behaviour, -1, &error);
- if (error)
- {
- g_print ("*** Error:\n"
- "*** %s\n", error->message);
- g_error_free (error);
- g_object_unref (script);
- return EXIT_FAILURE;
- }
-
file = g_build_filename (TESTS_DATADIR, "test-script.json", NULL);
clutter_script_load_from_file (script, file, &error);
if (error)
diff --git a/tests/interactive/test-texture-async.c b/tests/interactive/test-texture-async.c
index f88f382a5..5d172a6d7 100644
--- a/tests/interactive/test-texture-async.c
+++ b/tests/interactive/test-texture-async.c
@@ -52,9 +52,6 @@ size_change_cb (ClutterTexture *texture,
static
gboolean task (gpointer user_data)
{
- ClutterTimeline *timeline;
- ClutterAlpha *alpha;
- ClutterBehaviour *depth_behavior;
ClutterActor *image[4];
ClutterActor *clone[4];
ClutterActor *stage;
@@ -107,11 +104,10 @@ gboolean task (gpointer user_data)
for (i = 0; i < 3; i++)
{
- timeline = clutter_timeline_new (5000);
- alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
- depth_behavior = clutter_behaviour_depth_new (alpha, -2500, 0);
- clutter_behaviour_apply (depth_behavior, image[i]);
- clutter_timeline_start (timeline);
+ clutter_actor_animate (image[i], CLUTTER_LINEAR,
+ 5000,
+ "depth", -2500.0,
+ NULL);
}
return FALSE;
@@ -122,15 +118,13 @@ G_MODULE_EXPORT gint
test_texture_async_main (int argc, char *argv[])
{
ClutterActor *stage;
- ClutterColor stage_color = { 0x12, 0x34, 0x56, 0xff };
- gchar *path;
+ gchar *path;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
- g_thread_init (NULL);
- stage = clutter_stage_get_default ();
- clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
+ stage = clutter_stage_new ();
+ clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_LightSkyBlue);
clutter_actor_show (stage);
g_signal_connect (stage,
@@ -147,8 +141,5 @@ test_texture_async_main (int argc, char *argv[])
g_free (path);
- /*g_object_unref (depth_behavior);
- g_object_unref (timeline);*/
-
return EXIT_SUCCESS;
}