diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index 101f4bf0f..ac2e54afd 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -656,7 +656,6 @@ #include "clutter-units.h" #include "deprecated/clutter-actor.h" -#include "deprecated/clutter-behaviour.h" #include "deprecated/clutter-container.h" /* Internal enum used to control mapped state update. This is a hint @@ -14716,40 +14715,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 ClutterMargin * parse_margin (ClutterActor *self, JsonNode *node) @@ -14865,24 +14830,6 @@ clutter_actor_parse_custom_node (ClutterScriptable *scriptable, else g_slice_free (RotationInfo, info); } - else if (strcmp (name, "behaviours") == 0) - { - GSList *l; - -#ifdef CLUTTER_ENABLE_DEBUG - if (G_UNLIKELY (_clutter_diagnostic_enabled ())) - _clutter_diagnostic_message ("The 'behaviours' key is deprecated " - "and it should not be used in newly " - "written ClutterScript definitions."); -#endif - - 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) @@ -14953,26 +14900,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/clutter-deprecated.h b/clutter/clutter/clutter-deprecated.h index f13d0cf28..96ea52db8 100644 --- a/clutter/clutter/clutter-deprecated.h +++ b/clutter/clutter/clutter-deprecated.h @@ -7,7 +7,6 @@ #include "deprecated/clutter-alpha.h" #include "deprecated/clutter-animatable.h" #include "deprecated/clutter-animation.h" -#include "deprecated/clutter-behaviour.h" #include "deprecated/clutter-bin-layout.h" #include "deprecated/clutter-box.h" #include "deprecated/clutter-cairo-texture.h" diff --git a/clutter/clutter/clutter-path.c b/clutter/clutter/clutter-path.c index d80ddbeb6..facb7b07a 100644 --- a/clutter/clutter/clutter-path.c +++ b/clutter/clutter/clutter-path.c @@ -27,8 +27,7 @@ * and bezier curves. * * A #ClutterPath contains a description of a path consisting of - * straight lines and bezier curves. This can be used in a - * #ClutterBehaviourPath to animate an actor moving along the path. + * straight lines and bezier curves. * * The path consists of a series of nodes. Each node is one of the * following four types: @@ -244,9 +243,6 @@ clutter_path_finalize (GObject *object) * * Creates a new #ClutterPath instance with no nodes. * - * The object has a floating reference so if you add it to a - * #ClutterBehaviourPath then you do not need to unref it. - * * Return value: the newly created #ClutterPath * * Since: 1.0 @@ -267,9 +263,6 @@ clutter_path_new (void) * @desc. See clutter_path_add_string() for details of the format of * the string. * - * The object has a floating reference so if you add it to a - * #ClutterBehaviourPath then you do not need to unref it. - * * Return value: the newly created #ClutterPath * * Since: 1.0 diff --git a/clutter/clutter/clutter-script.c b/clutter/clutter/clutter-script.c index 5914545d6..d8305d0c0 100644 --- a/clutter/clutter/clutter-script.c +++ b/clutter/clutter/clutter-script.c @@ -75,65 +75,6 @@ * packing rules of Clutter still apply, and an actor cannot be packed * in multiple containers without unparenting it in between). * - * Behaviours and timelines can also be defined inside a UI definition - * buffer: - * - * - * - * And then to apply a defined behaviour to an actor defined inside the - * definition of an actor, the "behaviour" member can be used: - * - * - * - * A #ClutterAlpha belonging to a #ClutterBehaviour can only be defined - * implicitly like in the example above, or explicitly by setting the - * "alpha" property to point to a previously defined #ClutterAlpha, e.g.: - * - * - * - * Implicitely defined #ClutterAlphas and #ClutterTimelines - * can omit the `id`, as well as the `type` members, but will not be available - * using clutter_script_get_object() (they can, however, be extracted using the - * #ClutterBehaviour and #ClutterAlpha API respectively). - * * Signal handlers can be defined inside a Clutter UI definition file and * then autoconnected to their respective signals using the * clutter_script_connect_signals() function: @@ -210,7 +151,6 @@ * function * "type_func" := the GType function name, for non-standard classes * "children" := an array of names or objects to add as children - * "behaviours" := an array of names or objects to apply to an actor * "signals" := an array of signal definitions to connect to an object * "is-default" := a boolean flag used when defining the #ClutterStage; * if set to "true" the default stage will be used instead @@ -246,7 +186,6 @@ #include "clutter-debug.h" #include "deprecated/clutter-alpha.h" -#include "deprecated/clutter-behaviour.h" #include "deprecated/clutter-container.h" #include "deprecated/clutter-state.h" @@ -524,11 +463,10 @@ clutter_script_init (ClutterScript *script) /** * clutter_script_new: * - * Creates a new #ClutterScript instance. #ClutterScript can be used - * to load objects definitions for scenegraph elements, like actors, - * or behavioural elements, like behaviours and timelines. The - * definitions must be encoded using the JavaScript Object Notation (JSON) - * language. + * Creates a new #ClutterScript instance. #ClutterScript can be used to load + * objects definitions for scenegraph elements, like actors, or behavioural + * elements, like timelines. The definitions must be encoded using the + * JavaScript Object Notation (JSON) language. * * Return value: the newly created #ClutterScript instance. Use * g_object_unref() when done. @@ -863,9 +801,7 @@ construct_each_objects (gpointer key, if (oinfo->object == NULL) _clutter_script_construct_object (script, oinfo); - /* this will take care of setting up properties, - * adding children and applying behaviours - */ + /* this will take care of setting up properties and adding children */ _clutter_script_apply_properties (script, oinfo); } } diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index 94a005772..bf260e1ca 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -86,8 +86,6 @@ * fully opaque actors covering the whole visible area of the stage, * i.e. when no blending with the stage color happens over the whole * stage viewport - * - * A series of hints that enable or disable behaviours on the stage */ typedef enum /*< prefix=CLUTTER_STAGE >*/ { diff --git a/clutter/clutter/clutter-types.h b/clutter/clutter/clutter-types.h index d047b05d1..05c51b603 100644 --- a/clutter/clutter/clutter-types.h +++ b/clutter/clutter/clutter-types.h @@ -104,7 +104,6 @@ typedef union _ClutterEvent ClutterEvent; */ typedef struct _ClutterEventSequence ClutterEventSequence; -typedef struct _ClutterBehaviour ClutterBehaviour; /* deprecated */ typedef struct _ClutterShader ClutterShader; /* deprecated */ /** diff --git a/clutter/clutter/deprecated/clutter-alpha.c b/clutter/clutter/deprecated/clutter-alpha.c index 8eabc9588..4a2374969 100644 --- a/clutter/clutter/deprecated/clutter-alpha.c +++ b/clutter/clutter/deprecated/clutter-alpha.c @@ -39,9 +39,7 @@ * be available any more in the next major version of Clutter. * * A #ClutterAlpha binds a #ClutterTimeline to a progress function which - * translates the time T into an adimensional factor alpha. The factor can - * then be used to drive a #ClutterBehaviour, which will translate the - * alpha value into something meaningful for a #ClutterActor. + * translates the time T into an adimensional factor alpha. * * You should provide a #ClutterTimeline and bind it to the #ClutterAlpha * instance using clutter_alpha_set_timeline(). You should also set an @@ -59,9 +57,6 @@ * pause, stop or resume the #ClutterAlpha from calling the alpha function by * using the appropriate functions of the #ClutterTimeline object. * - * #ClutterAlpha is used to "drive" a #ClutterBehaviour instance, and it - * is internally used by the #ClutterAnimation API. - * * #ClutterAlpha is available since Clutter 0.2. * * #ClutterAlpha is deprecated since Clutter 1.12. #ClutterTimeline and @@ -78,9 +73,7 @@ * * The following JSON fragment defines a #ClutterAlpha * using a #ClutterTimeline with id "sine-timeline" and an alpha - * function called `my_sine_alpha`. The defined #ClutterAlpha - * instance can be reused in multiple #ClutterBehaviour - * definitions or for #ClutterAnimation definitions. + * function called `my_sine_alpha`. * * |[ * { @@ -645,9 +638,6 @@ clutter_alpha_get_timeline (ClutterAlpha *alpha) * bind a #ClutterTimeline object to the #ClutterAlpha instance * using clutter_alpha_set_timeline(). * - * You should use the newly created #ClutterAlpha instance inside - * a #ClutterBehaviour object. - * * Return value: the newly created empty #ClutterAlpha instance. * * Since: 0.2 diff --git a/clutter/clutter/deprecated/clutter-animation.c b/clutter/clutter/deprecated/clutter-animation.c index bb8c8a7a3..e182d984c 100644 --- a/clutter/clutter/deprecated/clutter-animation.c +++ b/clutter/clutter/deprecated/clutter-animation.c @@ -57,13 +57,6 @@ * #ClutterAnimatable interface it is possible for that instance to * control the way the initial and final states are interpolated. * - * #ClutterAnimations are distinguished from #ClutterBehaviours - * because the former can only control #GObject properties of a single - * #GObject instance, while the latter can control multiple properties - * using accessor functions inside the #ClutterBehaviour - * `alpha_notify` virtual function, and can control multiple #ClutterActors - * as well. - * * For convenience, it is possible to use the clutter_actor_animate() * function call which will take care of setting up and tearing down * a #ClutterAnimation instance and animate an actor between its current diff --git a/clutter/clutter/deprecated/clutter-behaviour.c b/clutter/clutter/deprecated/clutter-behaviour.c deleted file mode 100644 index c39b2e910..000000000 --- a/clutter/clutter/deprecated/clutter-behaviour.c +++ /dev/null @@ -1,657 +0,0 @@ -/* - * Clutter. - * - * An OpenGL based 'interactive canvas' library. - * - * Authored By Matthew Allum - * - * 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 . - */ - -/** - * 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 #ClutterActors; 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: - * - * ![](path-alpha-func.png) - * - * 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 discouraged sing Clutter - * 1.0, and formally deprecated since Clutter 1.6. You should use the - * [implicit animation][clutter-actor-animation] support inside #ClutterActor - * if you still have code using #ClutterBehaviour. - */ - -#include "clutter-build-config.h" - -#define CLUTTER_DISABLE_DEPRECATION_WARNINGS -#include "clutter-behaviour.h" -#include "clutter-alpha.h" - -#include "clutter-debug.h" -#include "clutter-main.h" -#include "clutter-marshal.h" -#include "clutter-private.h" -#include "clutter-scriptable.h" -#include "clutter-script-private.h" - -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 }; - -static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); - -G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterBehaviour, - clutter_behaviour, - G_TYPE_OBJECT, - G_ADD_PRIVATE (ClutterBehaviour) - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, - clutter_scriptable_iface_init)) - -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 - * - * Deprecated: 1.6 - */ - obj_props[PROP_ALPHA] = - g_param_spec_object ("alpha", - P_("Alpha"), - P_("Alpha Object to drive the behaviour"), - CLUTTER_TYPE_ALPHA, - CLUTTER_PARAM_READWRITE); - - g_object_class_install_properties (object_class, - PROP_LAST, - obj_props); - - klass->alpha_notify = clutter_behaviour_alpha_notify_unimplemented; - - /** - * ClutterBehaviour::applied: - * @behaviour: the #ClutterBehaviour that received the signal - * @actor: the actor the behaviour was applied to. - * - * The ::apply signal is emitted each time the behaviour is applied - * to an actor. - * - * Since: 0.4 - * - * Deprecated: 1.6 - */ - behave_signals[APPLIED] = - g_signal_new ("applied", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (ClutterBehaviourClass, applied), - NULL, NULL, NULL, - 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 - * - * Deprecated: 1.6 - */ - behave_signals[REMOVED] = - g_signal_new ("removed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (ClutterBehaviourClass, removed), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - CLUTTER_TYPE_ACTOR); -} - -static void -clutter_behaviour_init (ClutterBehaviour *self) -{ - self->priv = clutter_behaviour_get_instance_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 - * - * Deprecated: 1.6 - */ -void -clutter_behaviour_apply (ClutterBehaviour *behave, - ClutterActor *actor) -{ - ClutterBehaviourPrivate *priv; - - g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave)); - g_return_if_fail (CLUTTER_IS_ACTOR (actor)); - - priv = behave->priv; - - if (g_slist_find (priv->actors, actor)) - { - g_warning ("The behaviour of type %s already applies " - "to the actor of type %s", - g_type_name (G_OBJECT_TYPE (behave)), - g_type_name (G_OBJECT_TYPE (actor))); - return; - } - - priv->actors = g_slist_append (priv->actors, g_object_ref (actor)); - g_signal_connect (actor, "destroy", - G_CALLBACK (remove_actor_on_destroy), - behave); - - g_signal_emit (behave, behave_signals[APPLIED], 0, actor); -} - -/** - * clutter_behaviour_is_applied: - * @behave: a #ClutterBehaviour - * @actor: a #ClutterActor - * - * Check if @behave applied to @actor. - * - * Return value: TRUE if actor has behaviour. FALSE otherwise. - * - * Since: 0.4 - * - * Deprecated: 1.6 - */ -gboolean -clutter_behaviour_is_applied (ClutterBehaviour *behave, - ClutterActor *actor) -{ - g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), FALSE); - g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE); - - return (g_slist_find (behave->priv->actors, actor) != NULL); -} - -/** - * clutter_behaviour_remove: - * @behave: a #ClutterBehaviour - * @actor: a #ClutterActor - * - * Removes @actor from the list of #ClutterActors to which - * @behave applies. This function removes a reference on the actor. - * - * Since: 0.2 - * - * Deprecated: 1.6 - */ -void -clutter_behaviour_remove (ClutterBehaviour *behave, - ClutterActor *actor) -{ - ClutterBehaviourPrivate *priv; - - g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave)); - g_return_if_fail (CLUTTER_IS_ACTOR (actor)); - - priv = behave->priv; - - if (!g_slist_find (priv->actors, actor)) - { - g_warning ("The behaviour of type %s is not applied " - "to the actor of type %s", - g_type_name (G_OBJECT_TYPE (behave)), - g_type_name (G_OBJECT_TYPE (actor))); - return; - } - - g_signal_handlers_disconnect_by_func (actor, - G_CALLBACK (remove_actor_on_destroy), - behave); - - priv->actors = g_slist_remove (priv->actors, actor); - - g_signal_emit (behave, behave_signals[REMOVED], 0, actor); - - g_object_unref (actor); -} - -/** - * clutter_behaviour_get_n_actors: - * @behave: a #ClutterBehaviour - * - * Gets the number of actors this behaviour is applied too. - * - * Return value: The number of applied actors - * - * Since: 0.2 - * - * Deprecated: 1.6 - */ -gint -clutter_behaviour_get_n_actors (ClutterBehaviour *behave) -{ - g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), 0); - - return g_slist_length (behave->priv->actors); -} - -/** - * clutter_behaviour_get_nth_actor: - * @behave: a #ClutterBehaviour - * @index_: the index of an actor this behaviour is applied too. - * - * Gets an actor the behaviour was applied to referenced by index num. - * - * Return value: (transfer none): A Clutter actor or NULL if @index_ is invalid. - * - * Since: 0.2 - * - * Deprecated: 1.6 - */ -ClutterActor * -clutter_behaviour_get_nth_actor (ClutterBehaviour *behave, - gint index_) -{ - g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), NULL); - - return g_slist_nth_data (behave->priv->actors, index_); -} - - -/** - * clutter_behaviour_actors_foreach: - * @behave: a #ClutterBehaviour - * @func: (scope call): a function called for each actor - * @data: optional data to be passed to the function, or %NULL - * - * Calls @func for every actor driven by @behave. - * - * Since: 0.2 - * - * Deprecated: 1.6 - */ -void -clutter_behaviour_actors_foreach (ClutterBehaviour *behave, - ClutterBehaviourForeachFunc func, - gpointer data) -{ - GSList *l; - - g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave)); - g_return_if_fail (func != NULL); - - for (l = behave->priv->actors; l != NULL; l = l->next) - { - ClutterActor *actor = l->data; - - g_assert (CLUTTER_IS_ACTOR (actor)); - - func (behave, actor, data); - } -} - -/** - * clutter_behaviour_get_alpha: - * @behave: a #ClutterBehaviour - * - * Retrieves the #ClutterAlpha object bound to @behave. - * - * Return value: (transfer none): a #ClutterAlpha object, or %NULL if no alpha - * object has been bound to this behaviour. - * - * Since: 0.2 - * - * Deprecated: 1.6 - */ -ClutterAlpha * -clutter_behaviour_get_alpha (ClutterBehaviour *behave) -{ - g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), NULL); - - return behave->priv->alpha; -} - -static void -notify_cb (GObject *object, - GParamSpec *param_spec, - ClutterBehaviour *behave) -{ - ClutterBehaviourClass *klass; - - klass = CLUTTER_BEHAVIOUR_GET_CLASS (behave); - - CLUTTER_NOTE (ANIMATION, "notify::alpha"); - - /* no actors, we can stop right here */ - if (behave->priv->actors == NULL) - return; - - if (klass->alpha_notify != NULL) - { - gdouble alpha_value = clutter_alpha_get_alpha (behave->priv->alpha); - - CLUTTER_NOTE (ANIMATION, "calling %s::alpha_notify (%p, %.4f)", - g_type_name (G_TYPE_FROM_CLASS (klass)), - behave, alpha_value); - - klass->alpha_notify (behave, alpha_value); - } -} - -/** - * clutter_behaviour_set_alpha: - * @behave: a #ClutterBehaviour - * @alpha: a #ClutterAlpha or %NULL to unset a previously set alpha - * - * Binds @alpha to a #ClutterBehaviour. The #ClutterAlpha object - * is what makes a behaviour work: for each tick of the timeline - * used by #ClutterAlpha a new value of the alpha parameter is - * computed by the alpha function; the value should be used by - * the #ClutterBehaviour to update one or more properties of the - * actors to which the behaviour applies. - * - * If @alpha is not %NULL, the #ClutterBehaviour will take ownership - * of the #ClutterAlpha instance. - * - * Since: 0.2 - * - * Deprecated: 1.6 - */ -void -clutter_behaviour_set_alpha (ClutterBehaviour *behave, - ClutterAlpha *alpha) -{ - ClutterBehaviourPrivate *priv; - - g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave)); - g_return_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha)); - - priv = behave->priv; - - if (priv->alpha == alpha) - return; - - if (priv->notify_id) - { - CLUTTER_NOTE (ANIMATION, "removing previous notify-id (%d)", - priv->notify_id); - - g_signal_handler_disconnect (priv->alpha, priv->notify_id); - priv->notify_id = 0; - } - - if (priv->alpha != NULL) - { - CLUTTER_NOTE (ANIMATION, "removing previous alpha object"); - - g_object_unref (priv->alpha); - priv->alpha = NULL; - } - - if (alpha != NULL) - { - priv->alpha = g_object_ref_sink (alpha); - - priv->notify_id = g_signal_connect (priv->alpha, "notify::alpha", - G_CALLBACK(notify_cb), - behave); - - CLUTTER_NOTE (ANIMATION, "setting new alpha object (%p, notify:%d)", - priv->alpha, priv->notify_id); - } - - g_object_notify_by_pspec (G_OBJECT (behave), obj_props[PROP_ALPHA]); -} - -/** - * clutter_behaviour_get_actors: - * @behave: a #ClutterBehaviour - * - * Retrieves all the actors to which @behave applies. It is not recommended - * for derived classes to use this in there alpha notify method but use - * #clutter_behaviour_actors_foreach as it avoids alot of needless allocations. - * - * Return value: (transfer container) (element-type Clutter.Actor): a list of - * actors. You should free the returned list with g_slist_free() when - * finished using it. - * - * Since: 0.2 - * - * Deprecated: 1.6 - */ -GSList * -clutter_behaviour_get_actors (ClutterBehaviour *behave) -{ - ClutterBehaviourPrivate *priv; - GSList *retval, *l; - - g_return_val_if_fail (CLUTTER_BEHAVIOUR (behave), NULL); - - priv = behave->priv; - retval = NULL; - for (l = priv->actors; l != NULL; l = l->next) - retval = g_slist_prepend (retval, l->data); - - return g_slist_reverse (retval); -} - -/** - * clutter_behaviour_remove_all: - * @behave: a #ClutterBehaviour - * - * Removes every actor from the list that @behave holds. - * - * Since: 0.4 - * - * Deprecated: 1.6 - */ -void -clutter_behaviour_remove_all (ClutterBehaviour *behave) -{ - ClutterBehaviourPrivate *priv; - GSList *l; - - g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave)); - - priv = behave->priv; - for (l = priv->actors; l != NULL; l = l->next) - { - ClutterActor *actor = l->data; - - g_signal_emit (behave, behave_signals[REMOVED], 0, actor); - g_signal_handlers_disconnect_by_func (actor, - G_CALLBACK (remove_actor_on_destroy), - behave); - g_object_unref (actor); - } - - g_slist_free (priv->actors); - priv->actors = NULL; -} diff --git a/clutter/clutter/deprecated/clutter-behaviour.h b/clutter/clutter/deprecated/clutter-behaviour.h deleted file mode 100644 index 061e3364d..000000000 --- a/clutter/clutter/deprecated/clutter-behaviour.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Clutter. - * - * An OpenGL based 'interactive canvas' library. - * - * Authored By Matthew Allum - * Jorn Baayen - * Emmanuele Bassi - * - * 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 . - */ - -#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) -#error "Only can be included directly." -#endif - -#ifndef __CLUTTER_BEHAVIOUR_H__ -#define __CLUTTER_BEHAVIOUR_H__ - -#include - -G_BEGIN_DECLS - -#define CLUTTER_TYPE_BEHAVIOUR clutter_behaviour_get_type() - -#define CLUTTER_BEHAVIOUR(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviour)) - -#define CLUTTER_BEHAVIOUR_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass)) - -#define CLUTTER_IS_BEHAVIOUR(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - CLUTTER_TYPE_BEHAVIOUR)) - -#define CLUTTER_IS_BEHAVIOUR_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - CLUTTER_TYPE_BEHAVIOUR)) - -#define CLUTTER_BEHAVIOUR_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass)) - -typedef struct _ClutterBehaviourPrivate ClutterBehaviourPrivate; -typedef struct _ClutterBehaviourClass ClutterBehaviourClass; - -/** - * ClutterBehaviourForeachFunc: - * @behaviour: the #ClutterBehaviour - * @actor: an actor driven by @behaviour - * @data: (closure): optional data passed to the function - * - * This function is passed to clutter_behaviour_actors_foreach() and - * will be called for each actor driven by @behaviour. - * - * 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); -}; - -CLUTTER_DEPRECATED -GType clutter_behaviour_get_type (void) G_GNUC_CONST; - -CLUTTER_DEPRECATED -void clutter_behaviour_apply (ClutterBehaviour *behave, - ClutterActor *actor); -CLUTTER_DEPRECATED -void clutter_behaviour_remove (ClutterBehaviour *behave, - ClutterActor *actor); -CLUTTER_DEPRECATED -void clutter_behaviour_remove_all (ClutterBehaviour *behave); -CLUTTER_DEPRECATED -void clutter_behaviour_actors_foreach (ClutterBehaviour *behave, - ClutterBehaviourForeachFunc func, - gpointer data); -CLUTTER_DEPRECATED -gint clutter_behaviour_get_n_actors (ClutterBehaviour *behave); -CLUTTER_DEPRECATED -ClutterActor *clutter_behaviour_get_nth_actor (ClutterBehaviour *behave, - gint index_); -CLUTTER_DEPRECATED -GSList * clutter_behaviour_get_actors (ClutterBehaviour *behave); -CLUTTER_DEPRECATED -ClutterAlpha *clutter_behaviour_get_alpha (ClutterBehaviour *behave); -CLUTTER_DEPRECATED -void clutter_behaviour_set_alpha (ClutterBehaviour *behave, - ClutterAlpha *alpha); -CLUTTER_DEPRECATED -gboolean clutter_behaviour_is_applied (ClutterBehaviour *behave, - ClutterActor *actor); - -G_END_DECLS - -#endif /* __CLUTTER_BEHAVIOUR_H__ */ diff --git a/clutter/clutter/meson.build b/clutter/clutter/meson.build index 08a3b6082..8a1f3b2bc 100644 --- a/clutter/clutter/meson.build +++ b/clutter/clutter/meson.build @@ -222,7 +222,6 @@ clutter_deprecated_headers = [ 'deprecated/clutter-alpha.h', 'deprecated/clutter-animatable.h', 'deprecated/clutter-animation.h', - 'deprecated/clutter-behaviour.h', 'deprecated/clutter-bin-layout.h', 'deprecated/clutter-box.h', 'deprecated/clutter-cairo-texture.h', @@ -241,7 +240,6 @@ clutter_deprecated_headers = [ clutter_deprecated_sources = [ 'deprecated/clutter-alpha.c', 'deprecated/clutter-animation.c', - 'deprecated/clutter-behaviour.c', 'deprecated/clutter-box.c', 'deprecated/clutter-cairo-texture.c', 'deprecated/clutter-group.c', diff --git a/src/tests/clutter/interactive/test-script.json b/src/tests/clutter/interactive/test-script.json index 54d4fb457..2132c72d8 100644 --- a/src/tests/clutter/interactive/test-script.json +++ b/src/tests/clutter/interactive/test-script.json @@ -17,8 +17,7 @@ "reactive" : true, "rotation" : [ { "z-axis" : [ 45.0, [ 75, 75 ] ] } - ], - "behaviours" : [ "fade-behaviour", "path-behaviour" ] + ] }, { "id" : "green-button", @@ -43,8 +42,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",