From ce3e293a18fa912b4323bb6da11e1afddf55794f Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 26 Jun 2020 16:26:49 -0300 Subject: [PATCH] clutter: Drop ClutterGroup It is now unused. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332 --- clutter/clutter/cally/cally-group.c | 147 ----- clutter/clutter/cally/cally-group.h | 87 --- clutter/clutter/cally/cally.c | 3 - clutter/clutter/cally/cally.h | 1 - clutter/clutter/clutter-deprecated.h | 1 - clutter/clutter/clutter-group.h | 96 ---- clutter/clutter/clutter.h | 1 - clutter/clutter/deprecated/clutter-group.c | 530 ------------------ clutter/clutter/deprecated/clutter-group.h | 62 -- clutter/clutter/meson.build | 5 - cogl/tests/conform/test-multitexture.c | 2 +- cogl/tests/conform/test-texture-mipmaps.c | 2 +- .../cally-atkcomponent-example.c | 2 +- .../cally-atkeditabletext-example.c | 2 +- .../accessibility/cally-atktext-example.c | 2 +- .../accessibility/cally-clone-example.c | 2 +- .../clutter/conform/actor-paint-opacity.c | 4 +- src/tests/clutter/conform/group.c | 62 -- src/tests/clutter/conform/meson.build | 1 - src/tests/clutter/conform/texture-fbo.c | 2 +- .../interactive/test-cogl-multitexture.c | 2 +- .../interactive/test-cogl-tex-polygon.c | 2 +- src/tests/clutter/interactive/test-events.c | 2 +- .../clutter/interactive/test-paint-wrapper.c | 2 +- src/tests/clutter/micro-bench/test-text.c | 2 +- 25 files changed, 14 insertions(+), 1010 deletions(-) delete mode 100644 clutter/clutter/cally/cally-group.c delete mode 100644 clutter/clutter/cally/cally-group.h delete mode 100644 clutter/clutter/clutter-group.h delete mode 100644 clutter/clutter/deprecated/clutter-group.c delete mode 100644 clutter/clutter/deprecated/clutter-group.h delete mode 100644 src/tests/clutter/conform/group.c diff --git a/clutter/clutter/cally/cally-group.c b/clutter/clutter/cally/cally-group.c deleted file mode 100644 index 5d0cce5ca..000000000 --- a/clutter/clutter/cally/cally-group.c +++ /dev/null @@ -1,147 +0,0 @@ -/* CALLY - The Clutter Accessibility Implementation Library - * - * Copyright (C) 2008 Igalia, S.L. - * - * Author: Alejandro Piñeiro Iglesias - * - * Based on GailContainer from GAIL - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/** - * SECTION:cally-group - * @Title: CallyGroup - * @short_description: Implementation of the ATK interfaces for a #ClutterGroup - * @see_also: #ClutterGroup - * - * #CallyGroup implements the required ATK interfaces of #ClutterGroup - * In particular it exposes each of the Clutter actors contained in the - * group. - */ - -#include "clutter-build-config.h" - -#include "cally-group.h" -#include "cally-actor-private.h" - -static gint cally_group_get_n_children (AtkObject *obj); -static AtkObject* cally_group_ref_child (AtkObject *obj, - gint i); -static void cally_group_real_initialize (AtkObject *obj, - gpointer data); - -G_DEFINE_TYPE (CallyGroup, cally_group, CALLY_TYPE_ACTOR) - -static void -cally_group_class_init (CallyGroupClass *klass) -{ -/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->get_n_children = cally_group_get_n_children; - class->ref_child = cally_group_ref_child; - class->initialize = cally_group_real_initialize; -} - -static void -cally_group_init (CallyGroup *group) -{ - /* nothing to do yet */ -} - -/** - * cally_group_new: - * @actor: a #ClutterGroup - * - * Creates a #CallyGroup for @actor - * - * Return value: the newly created #CallyGroup - * - * Since: 1.4 - */ -AtkObject * -cally_group_new (ClutterActor *actor) -{ - GObject *object = NULL; - AtkObject *accessible = NULL; - - g_return_val_if_fail (CLUTTER_IS_GROUP (actor), NULL); - - object = g_object_new (CALLY_TYPE_GROUP, NULL); - - accessible = ATK_OBJECT (object); - atk_object_initialize (accessible, actor); - - return accessible; -} - -static gint -cally_group_get_n_children (AtkObject *obj) -{ - ClutterActor *actor = NULL; - gint count = 0; - - g_return_val_if_fail (CALLY_IS_GROUP (obj), count); - - actor = CALLY_GET_CLUTTER_ACTOR (obj); - - if (actor == NULL) /* defunct */ - return 0; - - g_return_val_if_fail (CLUTTER_IS_GROUP(actor), count); - - count = clutter_actor_get_n_children (actor); - - return count; -} - -static AtkObject* -cally_group_ref_child (AtkObject *obj, - gint i) -{ - AtkObject *accessible = NULL; - ClutterActor *actor = NULL; - ClutterActor *child = NULL; - - g_return_val_if_fail (CALLY_IS_GROUP (obj), NULL); - g_return_val_if_fail ((i >= 0), NULL); - - actor = CALLY_GET_CLUTTER_ACTOR (obj); - - g_return_val_if_fail (CLUTTER_IS_GROUP(actor), NULL); - child = clutter_actor_get_child_at_index (actor, i); - - if (!child) - return NULL; - - accessible = clutter_actor_get_accessible (child); - - if (accessible != NULL) - g_object_ref (accessible); - - return accessible; -} - -static void -cally_group_real_initialize (AtkObject *obj, - gpointer data) -{ - ATK_OBJECT_CLASS (cally_group_parent_class)->initialize (obj, data); - - obj->role = ATK_ROLE_PANEL; -} diff --git a/clutter/clutter/cally/cally-group.h b/clutter/clutter/cally/cally-group.h deleted file mode 100644 index d97240a9d..000000000 --- a/clutter/clutter/cally/cally-group.h +++ /dev/null @@ -1,87 +0,0 @@ -/* CALLY - The Clutter Accessibility Implementation Library - * - * Copyright (C) 2008 Igalia, S.L. - * - * Author: Alejandro Piñeiro Iglesias - * - * Based on GailContainer from GAIL - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 . - */ - -#ifndef __CALLY_GROUP_H__ -#define __CALLY_GROUP_H__ - -#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION) -#error "Only can be included directly." -#endif - -#include -#include - -G_BEGIN_DECLS - -#define CALLY_TYPE_GROUP (cally_group_get_type ()) -#define CALLY_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_GROUP, CallyGroup)) -#define CALLY_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_GROUP, CallyGroupClass)) -#define CALLY_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_GROUP)) -#define CALLY_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_GROUP)) -#define CALLY_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_GROUP, CallyGroupClass)) - -typedef struct _CallyGroup CallyGroup; -typedef struct _CallyGroupClass CallyGroupClass; -typedef struct _CallyGroupPrivate CallyGroupPrivate; - -/** - * CallyGroup: - * - * The CallyGroup structure contains only - * private data and should be accessed using the provided API - * - * Since: 1.4 - */ -struct _CallyGroup -{ - /*< private >*/ - CallyActor parent; - - CallyGroupPrivate *priv; -}; - -/** - * CallyGroupClass: - * - * The CallyGroupClass structure contains only - * private data - * - * Since: 1.4 - */ -struct _CallyGroupClass -{ - /*< private >*/ - CallyActorClass parent_class; - - /* padding for future expansion */ - gpointer _padding_dummy[8]; -}; - -CLUTTER_EXPORT -GType cally_group_get_type (void) G_GNUC_CONST; -CLUTTER_EXPORT -AtkObject* cally_group_new (ClutterActor *actor); - -G_END_DECLS - -#endif /* __CALLY_GROUP_H__ */ diff --git a/clutter/clutter/cally/cally.c b/clutter/clutter/cally/cally.c index 8b92682db..681536ec6 100644 --- a/clutter/clutter/cally/cally.c +++ b/clutter/clutter/cally/cally.c @@ -36,7 +36,6 @@ #include "cally.h" #include "cally-actor.h" -#include "cally-group.h" #include "cally-stage.h" #include "cally-text.h" #include "cally-rectangle.h" @@ -52,7 +51,6 @@ /* factories initialization*/ CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_ACTOR, cally_actor, cally_actor_new) -CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_GROUP, cally_group, cally_group_new) CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_STAGE, cally_stage, cally_stage_new) CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXT, cally_text, cally_text_new) CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_RECTANGLE, cally_rectangle, cally_rectangle_new) @@ -73,7 +71,6 @@ cally_accessibility_init (void) { /* setting the factories */ CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_ACTOR, cally_actor); - CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_GROUP, cally_group); CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_STAGE, cally_stage); CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXT, cally_text); CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_RECTANGLE, cally_rectangle); diff --git a/clutter/clutter/cally/cally.h b/clutter/clutter/cally/cally.h index 440c30be3..771778d97 100644 --- a/clutter/clutter/cally/cally.h +++ b/clutter/clutter/cally/cally.h @@ -26,7 +26,6 @@ #include "cally-actor.h" #include "cally-clone.h" #include "cally-factory.h" -#include "cally-group.h" #include "cally-main.h" #include "cally-rectangle.h" #include "cally-root.h" diff --git a/clutter/clutter/clutter-deprecated.h b/clutter/clutter/clutter-deprecated.h index c2bb1cff2..a99964ade 100644 --- a/clutter/clutter/clutter-deprecated.h +++ b/clutter/clutter/clutter-deprecated.h @@ -6,7 +6,6 @@ #include "deprecated/clutter-actor.h" #include "deprecated/clutter-box.h" #include "deprecated/clutter-container.h" -#include "deprecated/clutter-group.h" #include "deprecated/clutter-rectangle.h" #include "deprecated/clutter-stage.h" #include "deprecated/clutter-timeline.h" diff --git a/clutter/clutter/clutter-group.h b/clutter/clutter/clutter-group.h deleted file mode 100644 index 7f8e5f346..000000000 --- a/clutter/clutter/clutter-group.h +++ /dev/null @@ -1,96 +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 . - */ - -#ifndef __CLUTTER_GROUP_H__ -#define __CLUTTER_GROUP_H__ - -#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) -#error "Only can be included directly." -#endif - -#include -#include -#include - -G_BEGIN_DECLS - -#define CLUTTER_TYPE_GROUP (clutter_group_get_type ()) -#define CLUTTER_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_GROUP, ClutterGroup)) -#define CLUTTER_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_GROUP, ClutterGroupClass)) -#define CLUTTER_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_GROUP)) -#define CLUTTER_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_GROUP)) -#define CLUTTER_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_GROUP, ClutterGroupClass)) - -/* XXX - ClutterGroup is to be considered fully deprecated; the only - * reason we keep this header is because ClutterStage inherits from - * ClutterGroup, and thus we need to have a structure definition for - * the Stage object to expand. - */ - -typedef struct _ClutterGroup ClutterGroup; -typedef struct _ClutterGroupClass ClutterGroupClass; -typedef struct _ClutterGroupPrivate ClutterGroupPrivate; - -/** - * ClutterGroup: - * - * The #ClutterGroup structure contains only private data - * and should be accessed using the provided API - * - * Since: 0.2 - */ -struct _ClutterGroup -{ - /*< private >*/ - ClutterActor parent_instance; - - ClutterGroupPrivate *priv; -}; - -/** - * ClutterGroupClass: - * - * The #ClutterGroupClass structure contains only private data - * - * Since: 0.2 - */ -struct _ClutterGroupClass -{ - /*< private >*/ - ClutterActorClass parent_class; - - /* padding for future expansion */ - void (*_clutter_reserved1) (void); - void (*_clutter_reserved2) (void); - void (*_clutter_reserved3) (void); - void (*_clutter_reserved4) (void); - void (*_clutter_reserved5) (void); - void (*_clutter_reserved6) (void); -}; - -CLUTTER_EXPORT -GType clutter_group_get_type (void) G_GNUC_CONST; - -G_END_DECLS - -#endif /* __CLUTTER_GROUP_H__ */ diff --git a/clutter/clutter/clutter.h b/clutter/clutter/clutter.h index d5ffdd04f..efa52fa49 100644 --- a/clutter/clutter/clutter.h +++ b/clutter/clutter/clutter.h @@ -65,7 +65,6 @@ #include "clutter-flow-layout.h" #include "clutter-gesture-action.h" #include "clutter-grid-layout.h" -#include "clutter-group.h" #include "clutter-image.h" #include "clutter-input-device.h" #include "clutter-input-device-tool.h" diff --git a/clutter/clutter/deprecated/clutter-group.c b/clutter/clutter/deprecated/clutter-group.c deleted file mode 100644 index fedc6a60d..000000000 --- a/clutter/clutter/deprecated/clutter-group.c +++ /dev/null @@ -1,530 +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-group - * @short_description: A fixed layout container - * - * A #ClutterGroup is an Actor which contains multiple child actors positioned - * relative to the #ClutterGroup position. Other operations such as scaling, - * rotating and clipping of the group will apply to the child actors. - * - * A #ClutterGroup's size is defined by the size and position of its children; - * it will be the smallest non-negative size that covers the right and bottom - * edges of all of its children. - * - * Setting the size on a Group using #ClutterActor methods like - * clutter_actor_set_size() will override the natural size of the Group, - * however this will not affect the size of the children and they may still - * be painted outside of the allocation of the group. One way to constrain - * the visible area of a #ClutterGroup to a specified allocation is to - * explicitly set the size of the #ClutterGroup and then use the - * #ClutterActor:clip-to-allocation property. - * - * #ClutterGroup as a concrete class has been superceded by #ClutterActor - * since Clutter 1.10. The type itself is not deprecated as it is used by - * #ClutterStage. You should instantiate #ClutterActor and use its API to - * manage child actors. - */ - -#include "clutter-build-config.h" - -#include - -#define CLUTTER_DISABLE_DEPRECATION_WARNINGS -#include "clutter-group.h" - -#include "clutter-actor.h" -#include "clutter-actor-private.h" -#include "clutter-container.h" -#include "clutter-fixed-layout.h" -#include "clutter-main.h" -#include "clutter-debug.h" -#include "clutter-enum-types.h" -#include "clutter-marshal.h" -#include "clutter-private.h" - -#include "cogl/cogl.h" - -struct _ClutterGroupPrivate -{ - GList *children; - - ClutterLayoutManager *layout; -}; - -static void clutter_container_iface_init (ClutterContainerIface *iface); - -G_DEFINE_TYPE_WITH_CODE (ClutterGroup, clutter_group, CLUTTER_TYPE_ACTOR, - G_ADD_PRIVATE (ClutterGroup) - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER, - clutter_container_iface_init)); - -static gint -sort_by_depth (gconstpointer a, - gconstpointer b) -{ - gfloat depth_a = clutter_actor_get_z_position (CLUTTER_ACTOR(a)); - gfloat depth_b = clutter_actor_get_z_position (CLUTTER_ACTOR(b)); - - if (depth_a < depth_b) - return -1; - - if (depth_a > depth_b) - return 1; - - return 0; -} - -static void -clutter_group_real_add (ClutterContainer *container, - ClutterActor *actor) -{ - ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv; - - g_object_ref (actor); - - priv->children = g_list_append (priv->children, actor); - clutter_actor_add_child (CLUTTER_ACTOR (container), actor); - - clutter_container_sort_depth_order (container); - - g_object_unref (actor); -} - -static void -clutter_group_real_actor_added (ClutterContainer *container, - ClutterActor *actor) -{ - ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv; - - /* XXX - children added using clutter_actor_add_child() will - * cause actor-added to be emitted without going through the - * add() virtual function. - * - * if we get an actor-added for a child that is not in our - * list of children already, then we go in compatibility - * mode. - */ - if (g_list_find (priv->children, actor) != NULL) - return; - - priv->children = g_list_append (priv->children, actor); - clutter_container_sort_depth_order (container); -} - -static void -clutter_group_real_remove (ClutterContainer *container, - ClutterActor *actor) -{ - ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv; - - g_object_ref (actor); - - priv->children = g_list_remove (priv->children, actor); - clutter_actor_remove_child (CLUTTER_ACTOR (container), actor); - - g_object_unref (actor); -} - -static void -clutter_group_real_actor_removed (ClutterContainer *container, - ClutterActor *actor) -{ - ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv; - - /* XXX - same compatibility mode of the ::actor-added implementation */ - if (g_list_find (priv->children, actor) == NULL) - return; - - priv->children = g_list_remove (priv->children, actor); -} - -static void -clutter_group_real_raise (ClutterContainer *container, - ClutterActor *actor, - ClutterActor *sibling) -{ - ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv; - - priv->children = g_list_remove (priv->children, actor); - - /* Raise at the top */ - if (!sibling) - { - GList *last_item; - - last_item = g_list_last (priv->children); - - if (last_item) - sibling = last_item->data; - - priv->children = g_list_append (priv->children, actor); - } - else - { - gint index_ = g_list_index (priv->children, sibling) + 1; - - priv->children = g_list_insert (priv->children, actor, index_); - } - - /* set Z ordering a value below, this will then call sort - * as values are equal ordering shouldn't change but Z - * values will be correct. - * - * FIXME: get rid of this crap; this is so utterly broken and wrong on - * so many levels it's not even funny. sadly, we get to keep this until - * we can break API and remove Group for good. - */ - if (sibling && - clutter_actor_get_z_position (sibling) != clutter_actor_get_z_position (actor)) - { - clutter_actor_set_z_position (actor, clutter_actor_get_z_position (sibling)); - } - - clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); -} - -static void -clutter_group_real_lower (ClutterContainer *container, - ClutterActor *actor, - ClutterActor *sibling) -{ - ClutterGroup *self = CLUTTER_GROUP (container); - ClutterGroupPrivate *priv = self->priv; - - priv->children = g_list_remove (priv->children, actor); - - /* Push to bottom */ - if (!sibling) - { - GList *last_item; - - last_item = g_list_first (priv->children); - - if (last_item) - sibling = last_item->data; - - priv->children = g_list_prepend (priv->children, actor); - } - else - { - gint index_ = g_list_index (priv->children, sibling); - - priv->children = g_list_insert (priv->children, actor, index_); - } - - /* See comment in group_raise for this */ - if (sibling && - clutter_actor_get_z_position (sibling) != clutter_actor_get_z_position (actor)) - { - clutter_actor_set_z_position (actor, clutter_actor_get_z_position (sibling)); - } - - clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); -} - -static void -clutter_group_real_sort_depth_order (ClutterContainer *container) -{ - ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv; - - priv->children = g_list_sort (priv->children, sort_by_depth); - - clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); -} - -static void -clutter_container_iface_init (ClutterContainerIface *iface) -{ - iface->add = clutter_group_real_add; - iface->actor_added = clutter_group_real_actor_added; - iface->remove = clutter_group_real_remove; - iface->actor_removed = clutter_group_real_actor_removed; - iface->raise = clutter_group_real_raise; - iface->lower = clutter_group_real_lower; - iface->sort_depth_order = clutter_group_real_sort_depth_order; -} - -static void -clutter_group_real_paint (ClutterActor *actor, - ClutterPaintContext *paint_context) -{ - ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv; - - CLUTTER_NOTE (PAINT, "ClutterGroup paint enter '%s'", - _clutter_actor_get_debug_name (actor)); - - g_list_foreach (priv->children, (GFunc) clutter_actor_paint, paint_context); - - CLUTTER_NOTE (PAINT, "ClutterGroup paint leave '%s'", - _clutter_actor_get_debug_name (actor)); -} - -static void -clutter_group_real_pick (ClutterActor *actor, - ClutterPickContext *pick_context) -{ - ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv; - - /* Chain up so we get a bounding box pained (if we are reactive) */ - CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor, pick_context); - - g_list_foreach (priv->children, (GFunc) clutter_actor_pick, pick_context); -} - -static void -clutter_group_real_get_preferred_width (ClutterActor *actor, - gfloat for_height, - gfloat *min_width, - gfloat *natural_width) -{ - ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv; - - clutter_layout_manager_get_preferred_width (priv->layout, - CLUTTER_CONTAINER (actor), - for_height, - min_width, natural_width); -} - -static void -clutter_group_real_get_preferred_height (ClutterActor *actor, - gfloat for_width, - gfloat *min_height, - gfloat *natural_height) -{ - ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv; - - clutter_layout_manager_get_preferred_height (priv->layout, - CLUTTER_CONTAINER (actor), - for_width, - min_height, natural_height); -} - -static void -clutter_group_real_allocate (ClutterActor *actor, - const ClutterActorBox *allocation) -{ - ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv; - ClutterActorClass *klass; - - klass = CLUTTER_ACTOR_CLASS (clutter_group_parent_class); - klass->allocate (actor, allocation); - - if (priv->children == NULL) - return; - - clutter_layout_manager_allocate (priv->layout, - CLUTTER_CONTAINER (actor), - allocation); -} - -static void -clutter_group_dispose (GObject *object) -{ - ClutterGroup *self = CLUTTER_GROUP (object); - ClutterGroupPrivate *priv = self->priv; - - /* Note: we are careful to consider that destroying children could - * have the side-effect of destroying other children so - * priv->children may be modified during clutter_actor_destroy. */ - while (priv->children != NULL) - { - ClutterActor *child = priv->children->data; - priv->children = g_list_delete_link (priv->children, priv->children); - clutter_actor_destroy (child); - } - - if (priv->layout) - { - clutter_layout_manager_set_container (priv->layout, NULL); - g_object_unref (priv->layout); - priv->layout = NULL; - } - - G_OBJECT_CLASS (clutter_group_parent_class)->dispose (object); -} - -static void -clutter_group_real_hide_all (ClutterActor *actor) -{ - ClutterActorIter iter; - - clutter_actor_hide (actor); - - clutter_actor_iter_init (&iter, actor); - while (clutter_actor_iter_next (&iter, &actor)) - clutter_actor_hide (actor); -} - -static gboolean -clutter_group_real_get_paint_volume (ClutterActor *actor, - ClutterPaintVolume *volume) -{ - ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv; - GList *l; - - if (priv->children == NULL) - return TRUE; - - for (l = priv->children; l != NULL; l = l->next) - { - ClutterActor *child = l->data; - const ClutterPaintVolume *child_volume; - - /* This gets the paint volume of the child transformed into the - * group's coordinate space... */ - child_volume = clutter_actor_get_transformed_paint_volume (child, actor); - if (!child_volume) - return FALSE; - - clutter_paint_volume_union (volume, child_volume); - } - - return TRUE; -} - -static void -clutter_group_class_init (ClutterGroupClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - - actor_class->get_preferred_width = clutter_group_real_get_preferred_width; - actor_class->get_preferred_height = clutter_group_real_get_preferred_height; - actor_class->allocate = clutter_group_real_allocate; - actor_class->paint = clutter_group_real_paint; - actor_class->pick = clutter_group_real_pick; - actor_class->hide_all = clutter_group_real_hide_all; - actor_class->get_paint_volume = clutter_group_real_get_paint_volume; - - gobject_class->dispose = clutter_group_dispose; -} - -static void -clutter_group_init (ClutterGroup *self) -{ - ClutterActor *actor = CLUTTER_ACTOR (self); - - self->priv = clutter_group_get_instance_private (self); - - /* turn on some optimization - * - * XXX - these so-called "optimizations" are insane and should have never - * been used. they introduce some weird behaviour that breaks invariants - * and have to be explicitly worked around. - * - * this flag was set by the ClutterFixedLayout, but since that layout - * manager is now the default for ClutterActor, we set the flag explicitly - * here, to avoid breaking perfectly working actors overriding the - * allocate() virtual function. - * - * also, we keep this flag here so that it can die once we get rid of - * ClutterGroup. - */ - clutter_actor_set_flags (actor, CLUTTER_ACTOR_NO_LAYOUT); - - self->priv->layout = clutter_fixed_layout_new (); - g_object_ref_sink (self->priv->layout); - - clutter_actor_set_layout_manager (actor, self->priv->layout); -} - -/** - * clutter_group_new: - * - * Create a new #ClutterGroup. - * - * Return value: the newly created #ClutterGroup actor - * - * Deprecated: 1.10: Use clutter_actor_new() instead. - */ -ClutterActor * -clutter_group_new (void) -{ - return g_object_new (CLUTTER_TYPE_GROUP, NULL); -} - -/** - * clutter_group_remove_all: - * @self: A #ClutterGroup - * - * Removes all children actors from the #ClutterGroup. - * - * Deprecated: 1.10: Use clutter_actor_remove_all_children() instead. - */ -void -clutter_group_remove_all (ClutterGroup *self) -{ - g_return_if_fail (CLUTTER_IS_GROUP (self)); - - clutter_actor_remove_all_children (CLUTTER_ACTOR (self)); -} - -/** - * clutter_group_get_n_children: - * @self: A #ClutterGroup - * - * Gets the number of actors held in the group. - * - * Return value: The number of child actors held in the group. - * - * Since: 0.2 - * - * Deprecated: 1.10: Use clutter_actor_get_n_children() instead. - */ -gint -clutter_group_get_n_children (ClutterGroup *self) -{ - g_return_val_if_fail (CLUTTER_IS_GROUP (self), 0); - - return clutter_actor_get_n_children (CLUTTER_ACTOR (self)); -} - -/** - * clutter_group_get_nth_child: - * @self: A #ClutterGroup - * @index_: the position of the requested actor. - * - * Gets a groups child held at @index_ in stack. - * - * Return value: (transfer none): A Clutter actor, or %NULL if - * @index_ is invalid. - * - * Since: 0.2 - * - * Deprecated: 1.10: Use clutter_actor_get_child_at_index() instead. - */ -ClutterActor * -clutter_group_get_nth_child (ClutterGroup *self, - gint index_) -{ - ClutterActor *actor; - - g_return_val_if_fail (CLUTTER_IS_GROUP (self), NULL); - - actor = CLUTTER_ACTOR (self); - g_return_val_if_fail (index_ <= clutter_actor_get_n_children (actor), NULL); - - return clutter_actor_get_child_at_index (actor, index_); -} diff --git a/clutter/clutter/deprecated/clutter-group.h b/clutter/clutter/deprecated/clutter-group.h deleted file mode 100644 index 650f1dfc1..000000000 --- a/clutter/clutter/deprecated/clutter-group.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Clutter. - * - * An OpenGL based 'interactive canvas' library. - * - * Copyright (C) 2011 Intel Corp - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) -#error "Only can be included directly." -#endif - -#ifndef __CLUTTER_GROUP_DEPRECATED_H__ -#define __CLUTTER_GROUP_DEPRECATED_H__ - -#include -#include - -G_BEGIN_DECLS - -CLUTTER_DEPRECATED_FOR(clutter_actor_new) -ClutterActor * clutter_group_new (void); - -CLUTTER_DEPRECATED_FOR(clutter_actor_get_child_at_index) -ClutterActor * clutter_group_get_nth_child (ClutterGroup *self, - gint index_); - -CLUTTER_DEPRECATED_FOR(clutter_actor_get_n_children) -gint clutter_group_get_n_children (ClutterGroup *self); - -CLUTTER_DEPRECATED_FOR(clutter_actor_remove_all_children) -void clutter_group_remove_all (ClutterGroup *self); - -#ifndef CLUTTER_DISABLE_DEPRECATED - -/* for Mr. Mallum only */ -#define clutter_group_add(group,actor) G_STMT_START { \ - ClutterActor *_actor = (ClutterActor *) (actor); \ - if (CLUTTER_IS_GROUP ((group)) && CLUTTER_IS_ACTOR ((_actor))) \ - { \ - ClutterContainer *_container = (ClutterContainer *) (group); \ - clutter_container_add_actor (_container, _actor); \ - } } G_STMT_END - -#endif /* CLUTTER_DISABLE_DEPRECATED */ - -G_END_DECLS - -#endif /* __CLUTTER_GROUP_DEPRECATED_H__ */ diff --git a/clutter/clutter/meson.build b/clutter/clutter/meson.build index 179642740..5e7d25ac0 100644 --- a/clutter/clutter/meson.build +++ b/clutter/clutter/meson.build @@ -38,7 +38,6 @@ clutter_headers = [ 'clutter-flow-layout.h', 'clutter-gesture-action.h', 'clutter-grid-layout.h', - 'clutter-group.h', 'clutter-image.h', 'clutter-input-device.h', 'clutter-input-device-tool.h', @@ -223,7 +222,6 @@ clutter_deprecated_headers = [ 'deprecated/clutter-actor.h', 'deprecated/clutter-box.h', 'deprecated/clutter-container.h', - 'deprecated/clutter-group.h', 'deprecated/clutter-rectangle.h', 'deprecated/clutter-stage.h', 'deprecated/clutter-timeline.h', @@ -231,7 +229,6 @@ clutter_deprecated_headers = [ clutter_deprecated_sources = [ 'deprecated/clutter-box.c', - 'deprecated/clutter-group.c', 'deprecated/clutter-rectangle.c', ] @@ -288,7 +285,6 @@ cally_headers = [ 'cally/cally-actor.h', 'cally/cally-clone.h', 'cally/cally-factory.h', - 'cally/cally-group.h', 'cally/cally.h', 'cally/cally-main.h', 'cally/cally-rectangle.h', @@ -302,7 +298,6 @@ cally_sources = [ 'cally/cally-actor.c', 'cally/cally.c', 'cally/cally-clone.c', - 'cally/cally-group.c', 'cally/cally-rectangle.c', 'cally/cally-root.c', 'cally/cally-stage.c', diff --git a/cogl/tests/conform/test-multitexture.c b/cogl/tests/conform/test-multitexture.c index 391c4e703..4f43c1c6a 100644 --- a/cogl/tests/conform/test-multitexture.c +++ b/cogl/tests/conform/test-multitexture.c @@ -187,7 +187,7 @@ test_multitexture (TestUtilsGTestFixture *fixture, clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - group = clutter_group_new (); + group = clutter_actor_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group); /* We force continuous redrawing incase someone comments out the diff --git a/cogl/tests/conform/test-texture-mipmaps.c b/cogl/tests/conform/test-texture-mipmaps.c index 5345453d2..3093a1909 100644 --- a/cogl/tests/conform/test-texture-mipmaps.c +++ b/cogl/tests/conform/test-texture-mipmaps.c @@ -117,7 +117,7 @@ test_texture_mipmaps (TestUtilsGTestFixture *fixture, clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - group = clutter_group_new (); + group = clutter_actor_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group); /* We force continuous redrawing of the stage, since we need to skip diff --git a/src/tests/clutter/accessibility/cally-atkcomponent-example.c b/src/tests/clutter/accessibility/cally-atkcomponent-example.c index cd46c2274..09848dc89 100644 --- a/src/tests/clutter/accessibility/cally-atkcomponent-example.c +++ b/src/tests/clutter/accessibility/cally-atkcomponent-example.c @@ -72,7 +72,7 @@ main (int argc, char *argv[]) clutter_actor_set_size (button4, SIZE, SIZE); for (i = 0; i < 4; i++) { - group[i] = clutter_group_new (); + group[i] = clutter_actor_new (); clutter_actor_set_position (group[i], SIZE / 2, SIZE / 2); clutter_actor_set_size (group[i], SIZE, SIZE); diff --git a/src/tests/clutter/accessibility/cally-atkeditabletext-example.c b/src/tests/clutter/accessibility/cally-atkeditabletext-example.c index 2b31e006c..4c4c16376 100644 --- a/src/tests/clutter/accessibility/cally-atkeditabletext-example.c +++ b/src/tests/clutter/accessibility/cally-atkeditabletext-example.c @@ -149,7 +149,7 @@ _create_button (const gchar *text) ClutterActor *rectangle = NULL; ClutterActor *label = NULL; - button = clutter_group_new (); + button = clutter_actor_new (); rectangle = clutter_rectangle_new_with_color (CLUTTER_COLOR_Magenta); clutter_actor_set_size (rectangle, 375, 35); diff --git a/src/tests/clutter/accessibility/cally-atktext-example.c b/src/tests/clutter/accessibility/cally-atktext-example.c index aa540c7bf..5127e179c 100644 --- a/src/tests/clutter/accessibility/cally-atktext-example.c +++ b/src/tests/clutter/accessibility/cally-atktext-example.c @@ -209,7 +209,7 @@ make_ui (ClutterActor *stage) clutter_container_add_actor (CLUTTER_CONTAINER (stage), text_editable_actor); /* test button */ - button = clutter_group_new (); + button = clutter_actor_new (); rectangle = clutter_rectangle_new_with_color (&color_rect); clutter_actor_set_size (rectangle, 75, 35); diff --git a/src/tests/clutter/accessibility/cally-clone-example.c b/src/tests/clutter/accessibility/cally-clone-example.c index e80a8f1d1..9f6c916a2 100644 --- a/src/tests/clutter/accessibility/cally-clone-example.c +++ b/src/tests/clutter/accessibility/cally-clone-example.c @@ -70,7 +70,7 @@ make_ui (ClutterActor *stage) clutter_actor_set_position (rectangle, 150, 50); clutter_actor_add_constraint (rectangle, clutter_bind_constraint_new (editable, CLUTTER_BIND_SIZE, 0)); - full_entry = clutter_group_new (); + full_entry = clutter_actor_new (); clutter_actor_set_position (full_entry, 0, 50); clutter_actor_set_size (full_entry, 100, 75); clutter_container_add_actor (CLUTTER_CONTAINER (full_entry), label); diff --git a/src/tests/clutter/conform/actor-paint-opacity.c b/src/tests/clutter/conform/actor-paint-opacity.c index d6e77fce8..16d8d9231 100644 --- a/src/tests/clutter/conform/actor-paint-opacity.c +++ b/src/tests/clutter/conform/actor-paint-opacity.c @@ -84,7 +84,7 @@ opacity_paint (void) stage = clutter_test_get_stage (); - group1 = clutter_group_new (); + group1 = clutter_actor_new (); clutter_actor_set_opacity (group1, 128); clutter_container_add (CLUTTER_CONTAINER (stage), group1, NULL); clutter_actor_set_position (group1, 10, 30); @@ -111,7 +111,7 @@ opacity_paint (void) clutter_actor_destroy (label); - group2 = clutter_group_new (); + group2 = clutter_actor_new (); clutter_container_add (CLUTTER_CONTAINER (group1), group2, NULL); clutter_actor_set_position (group2, 10, 60); diff --git a/src/tests/clutter/conform/group.c b/src/tests/clutter/conform/group.c deleted file mode 100644 index 17036ee30..000000000 --- a/src/tests/clutter/conform/group.c +++ /dev/null @@ -1,62 +0,0 @@ -#define CLUTTER_DISABLE_DEPRECATION_WARNINGS -#include - -#include "tests/clutter-test-utils.h" - -static void -group_depth_sorting (void) -{ - ClutterActor *group; - ClutterActor *child, *test; - ClutterGroup *g; - GList *children; - - group = clutter_group_new (); - g = CLUTTER_GROUP (group); - - child = clutter_rectangle_new (); - clutter_actor_set_size (child, 20, 20); - clutter_actor_set_z_position (child, 0); - clutter_actor_set_name (child, "zero"); - clutter_container_add_actor (CLUTTER_CONTAINER (group), child); - - children = clutter_container_get_children (CLUTTER_CONTAINER (group)); - g_assert (children->data == child); - g_assert (children->next == NULL); - g_list_free (children); - - child = clutter_rectangle_new (); - clutter_actor_set_size (child, 20, 20); - clutter_actor_set_z_position (child, 10); - clutter_actor_set_name (child, "plus-ten"); - clutter_container_add_actor (CLUTTER_CONTAINER (group), child); - - test = clutter_group_get_nth_child (g, 0); - g_assert_cmpstr (clutter_actor_get_name (test), ==, "zero"); - - test = clutter_group_get_nth_child (g, 1); - g_assert_cmpstr (clutter_actor_get_name (test), ==, "plus-ten"); - - child = clutter_rectangle_new (); - clutter_actor_set_size (child, 20, 20); - clutter_actor_set_z_position (child, -10); - clutter_actor_set_name (child, "minus-ten"); - clutter_container_add_actor (CLUTTER_CONTAINER (group), child); - - g_assert_cmpint (clutter_group_get_n_children (g), ==, 3); - - test = clutter_group_get_nth_child (g, 0); - g_assert_cmpstr (clutter_actor_get_name (test), ==, "minus-ten"); - - test = clutter_group_get_nth_child (g, 1); - g_assert_cmpstr (clutter_actor_get_name (test), ==, "zero"); - - test = clutter_group_get_nth_child (g, 2); - g_assert_cmpstr (clutter_actor_get_name (test), ==, "plus-ten"); - - clutter_actor_destroy (group); -} - -CLUTTER_TEST_SUITE ( - CLUTTER_TEST_UNIT ("/group/depth-sorting", group_depth_sorting) -) diff --git a/src/tests/clutter/conform/meson.build b/src/tests/clutter/conform/meson.build index 4484380ee..842cd6f84 100644 --- a/src/tests/clutter/conform/meson.build +++ b/src/tests/clutter/conform/meson.build @@ -41,7 +41,6 @@ clutter_conform_tests_general_tests = [ ] clutter_conform_tests_deprecated_tests = [ - 'group', 'rectangle', ] diff --git a/src/tests/clutter/conform/texture-fbo.c b/src/tests/clutter/conform/texture-fbo.c index 5d3348f05..d5ab1de42 100644 --- a/src/tests/clutter/conform/texture-fbo.c +++ b/src/tests/clutter/conform/texture-fbo.c @@ -31,7 +31,7 @@ static ClutterActor * create_source (void) { int x, y; - ClutterActor *group = clutter_group_new (); + ClutterActor *group = clutter_actor_new (); /* Create a group with a different coloured rectangle at each corner */ diff --git a/src/tests/clutter/interactive/test-cogl-multitexture.c b/src/tests/clutter/interactive/test-cogl-multitexture.c index b64062225..cd2684664 100644 --- a/src/tests/clutter/interactive/test-cogl-multitexture.c +++ b/src/tests/clutter/interactive/test-cogl-multitexture.c @@ -138,7 +138,7 @@ test_cogl_multitexture_main (int argc, char *argv[]) * default paint handler, so that we can easily control * painting in a paint signal handler, without having to * sub-class anything etc. */ - state->group = clutter_group_new (); + state->group = clutter_actor_new (); clutter_actor_set_position (state->group, stage_w / 2, stage_h / 2); g_signal_connect (state->group, "paint", G_CALLBACK(material_rectangle_paint), state); diff --git a/src/tests/clutter/interactive/test-cogl-tex-polygon.c b/src/tests/clutter/interactive/test-cogl-tex-polygon.c index 5fbb6df54..e6235bacc 100644 --- a/src/tests/clutter/interactive/test-cogl-tex-polygon.c +++ b/src/tests/clutter/interactive/test-cogl-tex-polygon.c @@ -366,7 +366,7 @@ on_toggle_click (ClutterActor *button, ClutterEvent *event, static ClutterActor * make_toggle (const char *label_text, gboolean *toggle_val) { - ClutterActor *group = clutter_group_new (); + ClutterActor *group = clutter_actor_new (); ClutterActor *label = clutter_text_new_with_text ("Sans 14", label_text); ClutterActor *button = clutter_text_new_with_text ("Sans 14", ""); diff --git a/src/tests/clutter/interactive/test-events.c b/src/tests/clutter/interactive/test-events.c index 16fadfc35..4074b67eb 100644 --- a/src/tests/clutter/interactive/test-events.c +++ b/src/tests/clutter/interactive/test-events.c @@ -463,7 +463,7 @@ test_events_main (int argc, char *argv[]) g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "yellow box"); /* note group not reactive */ - group = clutter_group_new (); + group = clutter_actor_new (); clutter_container_add (CLUTTER_CONTAINER (group), actor, NULL); clutter_container_add (CLUTTER_CONTAINER (stage), group, NULL); clutter_actor_set_position (group, 100, 350); diff --git a/src/tests/clutter/interactive/test-paint-wrapper.c b/src/tests/clutter/interactive/test-paint-wrapper.c index 162681581..2a30fd55a 100644 --- a/src/tests/clutter/interactive/test-paint-wrapper.c +++ b/src/tests/clutter/interactive/test-paint-wrapper.c @@ -263,7 +263,7 @@ test_paint_wrapper_main (int argc, char *argv[]) } /* create a new group to hold multiple actors in a group */ - oh->group = clutter_group_new(); + oh->group = clutter_actor_new(); oh->hand = g_new (ClutterActor*, n_hands); diff --git a/src/tests/clutter/micro-bench/test-text.c b/src/tests/clutter/micro-bench/test-text.c index c3fa64132..fc7060565 100644 --- a/src/tests/clutter/micro-bench/test-text.c +++ b/src/tests/clutter/micro-bench/test-text.c @@ -58,7 +58,7 @@ main (int argc, char *argv[]) clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black); clutter_stage_set_title (CLUTTER_STAGE (stage), "Text"); - group = clutter_group_new (); + group = clutter_actor_new (); clutter_actor_set_size (group, STAGE_WIDTH, STAGE_WIDTH); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);