diff --git a/clutter/clutter/clutter-deprecated.h b/clutter/clutter/clutter-deprecated.h index 1673be861..5cc18725d 100644 --- a/clutter/clutter/clutter-deprecated.h +++ b/clutter/clutter/clutter-deprecated.h @@ -9,7 +9,6 @@ #include "deprecated/clutter-animation.h" #include "deprecated/clutter-behaviour.h" #include "deprecated/clutter-behaviour-depth.h" -#include "deprecated/clutter-behaviour-opacity.h" #include "deprecated/clutter-behaviour-scale.h" #include "deprecated/clutter-bin-layout.h" #include "deprecated/clutter-box.h" diff --git a/clutter/clutter/deprecated/clutter-behaviour-opacity.c b/clutter/clutter/deprecated/clutter-behaviour-opacity.c deleted file mode 100644 index a5220a9ff..000000000 --- a/clutter/clutter/deprecated/clutter-behaviour-opacity.c +++ /dev/null @@ -1,310 +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-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. - */ - -#include "clutter-build-config.h" - -#include - -#define CLUTTER_DISABLE_DEPRECATION_WARNINGS - -#include "clutter-alpha.h" -#include "clutter-behaviour.h" -#include "clutter-behaviour-opacity.h" -#include "clutter-private.h" -#include "clutter-debug.h" - -struct _ClutterBehaviourOpacityPrivate -{ - guint8 opacity_start; - guint8 opacity_end; -}; - -enum -{ - PROP_0, - - PROP_OPACITY_START, - PROP_OPACITY_END, - - PROP_LAST -}; - -static GParamSpec *obj_props[PROP_LAST]; - -G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourOpacity, - clutter_behaviour_opacity, - CLUTTER_TYPE_BEHAVIOUR) - -static void -alpha_notify_foreach (ClutterBehaviour *behaviour, - ClutterActor *actor, - gpointer data) -{ - clutter_actor_set_opacity (actor, GPOINTER_TO_UINT(data)); -} - -static void -clutter_behaviour_alpha_notify (ClutterBehaviour *behave, - gdouble alpha_value) -{ - ClutterBehaviourOpacityPrivate *priv; - guint8 opacity; - - priv = CLUTTER_BEHAVIOUR_OPACITY (behave)->priv; - - opacity = alpha_value - * (priv->opacity_end - priv->opacity_start) - + priv->opacity_start; - - CLUTTER_NOTE (ANIMATION, "alpha: %.4f, opacity: %u", - alpha_value, - opacity); - - clutter_behaviour_actors_foreach (behave, - alpha_notify_foreach, - GUINT_TO_POINTER ((guint) opacity)); -} - -static void -clutter_behaviour_opacity_set_property (GObject *gobject, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject); - - switch (prop_id) - { - case PROP_OPACITY_START: - clutter_behaviour_opacity_set_bounds (self, - g_value_get_uint (value), - self->priv->opacity_end); - break; - - case PROP_OPACITY_END: - clutter_behaviour_opacity_set_bounds (self, - self->priv->opacity_start, - g_value_get_uint (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -static void -clutter_behaviour_opacity_get_property (GObject *gobject, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject); - - switch (prop_id) - { - case PROP_OPACITY_START: - g_value_set_uint (value, self->priv->opacity_start); - break; - - case PROP_OPACITY_END: - g_value_set_uint (value, self->priv->opacity_end); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -static void -clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass); - GParamSpec *pspec; - - 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_instance_private (self); -} - -/** - * 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/deprecated/clutter-behaviour-opacity.h b/clutter/clutter/deprecated/clutter-behaviour-opacity.h deleted file mode 100644 index 2f562ee64..000000000 --- a/clutter/clutter/deprecated/clutter-behaviour-opacity.h +++ /dev/null @@ -1,115 +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_OPACITY_H__ -#define __CLUTTER_BEHAVIOUR_OPACITY_H__ - -#include - -G_BEGIN_DECLS - -#define CLUTTER_TYPE_BEHAVIOUR_OPACITY (clutter_behaviour_opacity_get_type ()) - -#define CLUTTER_BEHAVIOUR_OPACITY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacity)) - -#define CLUTTER_BEHAVIOUR_OPACITY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass)) - -#define CLUTTER_IS_BEHAVIOUR_OPACITY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - CLUTTER_TYPE_BEHAVIOUR_OPACITY)) - -#define CLUTTER_IS_BEHAVIOUR_OPACITY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - CLUTTER_TYPE_BEHAVIOUR_OPACITY)) - -#define CLUTTER_BEHAVIOUR_OPACITY_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass)) - -typedef struct _ClutterBehaviourOpacity ClutterBehaviourOpacity; -typedef struct _ClutterBehaviourOpacityPrivate ClutterBehaviourOpacityPrivate; -typedef struct _ClutterBehaviourOpacityClass ClutterBehaviourOpacityClass; - -/** - * ClutterBehaviourOpacity: - * - * The #ClutterBehaviourOpacity structure contains only private data and - * should be accessed using the provided API - * - * 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; -}; - -CLUTTER_DEPRECATED -GType clutter_behaviour_opacity_get_type (void) G_GNUC_CONST; - -CLUTTER_DEPRECATED_FOR(clutter_actor_animate and ClutterActor:opacity) -ClutterBehaviour *clutter_behaviour_opacity_new (ClutterAlpha *alpha, - guint8 opacity_start, - guint8 opacity_end); - -CLUTTER_DEPRECATED -void clutter_behaviour_opacity_set_bounds (ClutterBehaviourOpacity *behaviour, - guint8 opacity_start, - guint8 opacity_end); -CLUTTER_DEPRECATED -void clutter_behaviour_opacity_get_bounds (ClutterBehaviourOpacity *behaviour, - guint8 *opacity_start, - guint8 *opacity_end); - -G_END_DECLS - -#endif /* __CLUTTER_BEHAVIOUR_OPACITY_H__ */ diff --git a/clutter/clutter/meson.build b/clutter/clutter/meson.build index eff7c2230..95ee967a7 100644 --- a/clutter/clutter/meson.build +++ b/clutter/clutter/meson.build @@ -224,7 +224,6 @@ clutter_deprecated_headers = [ 'deprecated/clutter-animation.h', 'deprecated/clutter-behaviour.h', 'deprecated/clutter-behaviour-depth.h', - 'deprecated/clutter-behaviour-opacity.h', 'deprecated/clutter-behaviour-scale.h', 'deprecated/clutter-bin-layout.h', 'deprecated/clutter-box.h', @@ -246,7 +245,6 @@ clutter_deprecated_sources = [ 'deprecated/clutter-animation.c', 'deprecated/clutter-behaviour.c', 'deprecated/clutter-behaviour-depth.c', - 'deprecated/clutter-behaviour-opacity.c', 'deprecated/clutter-behaviour-scale.c', 'deprecated/clutter-box.c', 'deprecated/clutter-cairo-texture.c', diff --git a/src/tests/clutter/conform/behaviours.c b/src/tests/clutter/conform/behaviours.c deleted file mode 100644 index 523477106..000000000 --- a/src/tests/clutter/conform/behaviours.c +++ /dev/null @@ -1,88 +0,0 @@ -#define CLUTTER_DISABLE_DEPRECATION_WARNINGS -#include - -#include "tests/clutter-test-utils.h" - -static void -behaviour_opacity (void) -{ - ClutterBehaviour *behaviour; - ClutterTimeline *timeline; - ClutterAlpha *alpha; - guint8 start, end; - guint starti; - - timeline = clutter_timeline_new (500); - alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR); - behaviour = clutter_behaviour_opacity_new (alpha, 0, 255); - g_assert (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour)); - g_object_add_weak_pointer (G_OBJECT (behaviour), (gpointer *) &behaviour); - g_object_add_weak_pointer (G_OBJECT (timeline), (gpointer *) &timeline); - - 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); - g_object_unref (timeline); - - g_assert_null (behaviour); - g_assert_null (timeline); -} - -static struct -{ - const gchar *path; - GTestFunc func; -} behaviour_tests[] = { - { "opacity", behaviour_opacity }, -}; - -static const int n_behaviour_tests = G_N_ELEMENTS (behaviour_tests); - -int -main (int argc, char *argv[]) -{ - int i; - - meta_wayland_override_display_name ("mutter-test-display"); - meta_xwayland_override_display_number (512); - meta_override_compositor_configuration (META_COMPOSITOR_TYPE_WAYLAND, - META_TYPE_BACKEND_X11_NESTED); - meta_init (); - - clutter_test_init (&argc, &argv); - - for (i = 0; i < n_behaviour_tests; i++) - { - char *path = g_strconcat ("/behaviours/", behaviour_tests[i].path, NULL); - - clutter_test_add (path, behaviour_tests[i].func); - - g_free (path); - } - - return clutter_test_run (); -} diff --git a/src/tests/clutter/conform/meson.build b/src/tests/clutter/conform/meson.build index eced790b1..d565934d4 100644 --- a/src/tests/clutter/conform/meson.build +++ b/src/tests/clutter/conform/meson.build @@ -36,7 +36,6 @@ clutter_conform_tests_general_tests = [ ] clutter_conform_tests_deprecated_tests = [ - 'behaviours', 'group', 'rectangle', ] diff --git a/src/tests/clutter/conform/script-parser.c b/src/tests/clutter/conform/script-parser.c index d7fad094a..b51db38d6 100644 --- a/src/tests/clutter/conform/script-parser.c +++ b/src/tests/clutter/conform/script-parser.c @@ -198,44 +198,6 @@ script_single (void) g_free (test_file); } -static void -script_implicit_alpha (void) -{ - ClutterScript *script = clutter_script_new (); - ClutterTimeline *timeline; - GObject *behaviour = NULL; - GError *error = NULL; - ClutterAlpha *alpha; - gchar *test_file; - - test_file = g_test_build_filename (G_TEST_DIST, "scripts", "test-script-implicit-alpha.json", NULL); - 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); -} - static void script_object_property (void) { @@ -422,7 +384,6 @@ CLUTTER_TEST_SUITE ( CLUTTER_TEST_UNIT ("/script/container-child", script_child) CLUTTER_TEST_UNIT ("/script/named-object", script_named_object) CLUTTER_TEST_UNIT ("/script/animation", script_animation) - CLUTTER_TEST_UNIT ("/script/implicit-alpha", script_implicit_alpha) CLUTTER_TEST_UNIT ("/script/object-property", script_object_property) CLUTTER_TEST_UNIT ("/script/layout-property", script_layout_property) CLUTTER_TEST_UNIT ("/script/actor-margin", script_margin) diff --git a/src/tests/clutter/conform/scripts/test-script-implicit-alpha.json b/src/tests/clutter/conform/scripts/test-script-implicit-alpha.json deleted file mode 100644 index 5aab70d3d..000000000 --- a/src/tests/clutter/conform/scripts/test-script-implicit-alpha.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "id" : "test", - "type" : "ClutterBehaviourOpacity", - "alpha" : { - "mode" : "easeOutCirc", - "timeline" : { "duration" : 500 } - } -} diff --git a/src/tests/clutter/interactive/test-script.c b/src/tests/clutter/interactive/test-script.c index d84235c4d..999e5191b 100644 --- a/src/tests/clutter/interactive/test-script.c +++ b/src/tests/clutter/interactive/test-script.c @@ -47,18 +47,6 @@ static const gchar *test_behaviour = " \"function\" : \"sine_alpha\"," " \"timeline\" : \"main-timeline\"" " }," -" {" -" \"id\" : \"fade-behaviour\"," -" \"type\" : \"ClutterBehaviourOpacity\"," -" \"opacity-start\" : 255," -" \"opacity-end\" : 0," -" \"alpha\" : {" -" \"id\" : \"fade-alpha\"," -" \"type\" : \"ClutterAlpha\"," -" \"timeline\" : \"main-timeline\"," -" \"mode\" : \"linear\"" -" }" -" }" "]"; static gboolean