clutter: Remove deprecated ClutterGroup

This commit is contained in:
Niels De Graef 2018-11-17 13:50:51 +01:00
parent 19137361d7
commit a8ee0d8b80
46 changed files with 43 additions and 1081 deletions

View File

@ -78,7 +78,6 @@ source_h = \
clutter-flow-layout.h \ clutter-flow-layout.h \
clutter-gesture-action.h \ clutter-gesture-action.h \
clutter-grid-layout.h \ clutter-grid-layout.h \
clutter-group.h \
clutter-image.h \ clutter-image.h \
clutter-input-device.h \ clutter-input-device.h \
clutter-input-device-tool.h \ clutter-input-device-tool.h \
@ -271,7 +270,6 @@ deprecated_h = \
deprecated/clutter-box.h \ deprecated/clutter-box.h \
deprecated/clutter-cairo-texture.h \ deprecated/clutter-cairo-texture.h \
deprecated/clutter-container.h \ deprecated/clutter-container.h \
deprecated/clutter-group.h \
deprecated/clutter-input-device.h \ deprecated/clutter-input-device.h \
deprecated/clutter-keysyms.h \ deprecated/clutter-keysyms.h \
deprecated/clutter-main.h \ deprecated/clutter-main.h \
@ -300,7 +298,6 @@ deprecated_c = \
deprecated/clutter-behaviour-scale.c \ deprecated/clutter-behaviour-scale.c \
deprecated/clutter-box.c \ deprecated/clutter-box.c \
deprecated/clutter-cairo-texture.c \ deprecated/clutter-cairo-texture.c \
deprecated/clutter-group.c \
deprecated/clutter-input-device-deprecated.c \ deprecated/clutter-input-device-deprecated.c \
deprecated/clutter-layout-manager-deprecated.c \ deprecated/clutter-layout-manager-deprecated.c \
deprecated/clutter-rectangle.c \ deprecated/clutter-rectangle.c \

View File

@ -1,147 +0,0 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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;
}

View File

@ -1,87 +0,0 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __CALLY_GROUP_H__
#define __CALLY_GROUP_H__
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#include <cally/cally-actor.h>
#include <clutter/clutter.h>
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 <structname>CallyGroup</structname> 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 <structname>CallyGroupClass</structname> 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__ */

View File

@ -63,7 +63,7 @@ struct _CallyStagePrivate
G_DEFINE_TYPE_WITH_CODE (CallyStage, G_DEFINE_TYPE_WITH_CODE (CallyStage,
cally_stage, cally_stage,
CALLY_TYPE_GROUP, CALLY_TYPE_ACTOR,
G_ADD_PRIVATE (CallyStage) G_ADD_PRIVATE (CallyStage)
G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW, G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW,
cally_stage_window_interface_init)); cally_stage_window_interface_init));

View File

@ -25,7 +25,7 @@
#error "Only <cally/cally.h> can be included directly." #error "Only <cally/cally.h> can be included directly."
#endif #endif
#include <cally/cally-group.h> #include <cally/cally-actor.h>
#include <clutter/clutter.h> #include <clutter/clutter.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -52,7 +52,7 @@ typedef struct _CallyStagePrivate CallyStagePrivate;
struct _CallyStage struct _CallyStage
{ {
/*< private >*/ /*< private >*/
CallyGroup parent; CallyActor parent;
CallyStagePrivate *priv; CallyStagePrivate *priv;
}; };
@ -68,7 +68,7 @@ struct _CallyStage
struct _CallyStageClass struct _CallyStageClass
{ {
/*< private >*/ /*< private >*/
CallyGroupClass parent_class; CallyActorClass parent_class;
/* padding for future expansion */ /* padding for future expansion */
gpointer _padding_dummy[16]; gpointer _padding_dummy[16];

View File

@ -36,7 +36,6 @@
#include "cally.h" #include "cally.h"
#include "cally-actor.h" #include "cally-actor.h"
#include "cally-group.h"
#include "cally-stage.h" #include "cally-stage.h"
#include "cally-text.h" #include "cally-text.h"
#include "cally-texture.h" #include "cally-texture.h"
@ -53,7 +52,6 @@
/* factories initialization*/ /* factories initialization*/
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_ACTOR, cally_actor, cally_actor_new) 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_STAGE, cally_stage, cally_stage_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXT, cally_text, cally_text_new) CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXT, cally_text, cally_text_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXTURE, cally_texture, cally_texture_new) CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXTURE, cally_texture, cally_texture_new)
@ -75,7 +73,6 @@ cally_accessibility_init (void)
{ {
/* setting the factories */ /* setting the factories */
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_ACTOR, cally_actor); 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_STAGE, cally_stage);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXT, cally_text); CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXT, cally_text);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXTURE, cally_texture); CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXTURE, cally_texture);

View File

@ -26,7 +26,6 @@
#include "cally-actor.h" #include "cally-actor.h"
#include "cally-clone.h" #include "cally-clone.h"
#include "cally-factory.h" #include "cally-factory.h"
#include "cally-group.h"
#include "cally-main.h" #include "cally-main.h"
#include "cally-rectangle.h" #include "cally-rectangle.h"
#include "cally-root.h" #include "cally-root.h"

View File

@ -43,7 +43,7 @@
* *
* Constraints can be used with fixed layout managers, like * Constraints can be used with fixed layout managers, like
* #ClutterFixedLayout, or with actors implicitly using a fixed layout * #ClutterFixedLayout, or with actors implicitly using a fixed layout
* manager, like #ClutterGroup and #ClutterStage. * manager, like #ClutterStage.
* *
* Constraints provide a way to build user interfaces by using * Constraints provide a way to build user interfaces by using
* relations between #ClutterActors, without explicit fixed * relations between #ClutterActors, without explicit fixed

View File

@ -20,7 +20,6 @@
#include "deprecated/clutter-box.h" #include "deprecated/clutter-box.h"
#include "deprecated/clutter-cairo-texture.h" #include "deprecated/clutter-cairo-texture.h"
#include "deprecated/clutter-container.h" #include "deprecated/clutter-container.h"
#include "deprecated/clutter-group.h"
#include "deprecated/clutter-input-device.h" #include "deprecated/clutter-input-device.h"
#include "deprecated/clutter-keysyms.h" #include "deprecated/clutter-keysyms.h"
#include "deprecated/clutter-main.h" #include "deprecated/clutter-main.h"

View File

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

View File

@ -204,7 +204,7 @@ static void free_queue_redraw_entry (ClutterStageQueueRedrawEntry *entry);
static void clutter_container_iface_init (ClutterContainerIface *iface); static void clutter_container_iface_init (ClutterContainerIface *iface);
G_DEFINE_TYPE_WITH_CODE (ClutterStage, clutter_stage, CLUTTER_TYPE_GROUP, G_DEFINE_TYPE_WITH_CODE (ClutterStage, clutter_stage, CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (ClutterStage) G_ADD_PRIVATE (ClutterStage)
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER, G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
clutter_container_iface_init)) clutter_container_iface_init))
@ -685,10 +685,6 @@ _clutter_stage_paint_view (ClutterStage *stage,
g_signal_emit (stage, stage_signals[AFTER_PAINT], 0); g_signal_emit (stage, stage_signals[AFTER_PAINT], 0);
} }
/* If we don't implement this here, we get the paint function
* from the deprecated clutter-group class, which doesn't
* respect the Z order as it uses our empty sort_depth_order.
*/
static void static void
clutter_stage_paint (ClutterActor *self) clutter_stage_paint (ClutterActor *self)
{ {
@ -707,9 +703,9 @@ clutter_stage_pick (ClutterActor *self,
ClutterActorIter iter; ClutterActorIter iter;
ClutterActor *child; ClutterActor *child;
/* Note: we don't chain up to our parent as we don't want any geometry /* Note: we don't want any geometry emitted for the stage itself. The stage's
* emitted for the stage itself. The stage's pick id is effectively handled * pick id is effectively handled by the call to cogl_clear done in
* by the call to cogl_clear done in clutter-main.c:_clutter_do_pick_async() * clutter-main.c:_clutter_do_pick_async()
*/ */
clutter_actor_iter_init (&iter, self); clutter_actor_iter_init (&iter, self);
while (clutter_actor_iter_next (&iter, &child)) while (clutter_actor_iter_next (&iter, &child))
@ -756,9 +752,6 @@ clutter_stage_show_all (ClutterActor *self)
ClutterActorIter iter; ClutterActorIter iter;
ClutterActor *child; ClutterActor *child;
/* we don't do a recursive show_all(), to maintain the old
* invariants from ClutterGroup
*/
clutter_actor_iter_init (&iter, self); clutter_actor_iter_init (&iter, self);
while (clutter_actor_iter_next (&iter, &child)) while (clutter_actor_iter_next (&iter, &child))
clutter_actor_show (child); clutter_actor_show (child);
@ -789,9 +782,6 @@ clutter_stage_hide_all (ClutterActor *self)
clutter_actor_hide (self); clutter_actor_hide (self);
/* we don't do a recursive hide_all(), to maintain the old invariants
* from ClutterGroup
*/
clutter_actor_iter_init (&iter, self); clutter_actor_iter_init (&iter, self);
while (clutter_actor_iter_next (&iter, &child)) while (clutter_actor_iter_next (&iter, &child))
clutter_actor_hide (child); clutter_actor_hide (child);

View File

@ -28,8 +28,8 @@
#error "Only <clutter/clutter.h> can be included directly." #error "Only <clutter/clutter.h> can be included directly."
#endif #endif
#include <clutter/clutter-actor-private.h>
#include <clutter/clutter-types.h> #include <clutter/clutter-types.h>
#include <clutter/clutter-group.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -55,10 +55,11 @@ typedef struct _ClutterStagePrivate ClutterStagePrivate;
struct _ClutterStage struct _ClutterStage
{ {
/*< private >*/ /*< private >*/
ClutterGroup parent_instance; ClutterActor parent_instance;
ClutterStagePrivate *priv; ClutterStagePrivate *priv;
}; };
/** /**
* ClutterStageClass: * ClutterStageClass:
* @fullscreen: handler for the #ClutterStage::fullscreen signal * @fullscreen: handler for the #ClutterStage::fullscreen signal
@ -75,7 +76,7 @@ struct _ClutterStage
struct _ClutterStageClass struct _ClutterStageClass
{ {
/*< private >*/ /*< private >*/
ClutterGroupClass parent_class; ClutterActorClass parent_class;
/*< public >*/ /*< public >*/
/* signals */ /* signals */

View File

@ -68,7 +68,6 @@
#include "clutter-flow-layout.h" #include "clutter-flow-layout.h"
#include "clutter-gesture-action.h" #include "clutter-gesture-action.h"
#include "clutter-grid-layout.h" #include "clutter-grid-layout.h"
#include "clutter-group.h"
#include "clutter-image.h" #include "clutter-image.h"
#include "clutter-input-device.h" #include "clutter-input-device.h"
#include "clutter-input-device-tool.h" #include "clutter-input-device-tool.h"

View File

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

View File

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

View File

@ -27,6 +27,7 @@
#define __CLUTTER_BACKEND_EGL_NATIVE_H__ #define __CLUTTER_BACKEND_EGL_NATIVE_H__
#include <glib-object.h> #include <glib-object.h>
#include <gio/gio.h>
#include <cogl/cogl.h> #include <cogl/cogl.h>
#include <cogl/cogl-egl.h> #include <cogl/cogl-egl.h>
#include <clutter/clutter-event.h> #include <clutter/clutter-event.h>

View File

@ -40,7 +40,6 @@ clutter_headers = [
'clutter-flow-layout.h', 'clutter-flow-layout.h',
'clutter-gesture-action.h', 'clutter-gesture-action.h',
'clutter-grid-layout.h', 'clutter-grid-layout.h',
'clutter-group.h',
'clutter-image.h', 'clutter-image.h',
'clutter-input-device.h', 'clutter-input-device.h',
'clutter-input-device-tool.h', 'clutter-input-device-tool.h',
@ -231,7 +230,6 @@ clutter_deprecated_headers = [
'deprecated/clutter-box.h', 'deprecated/clutter-box.h',
'deprecated/clutter-cairo-texture.h', 'deprecated/clutter-cairo-texture.h',
'deprecated/clutter-container.h', 'deprecated/clutter-container.h',
'deprecated/clutter-group.h',
'deprecated/clutter-input-device.h', 'deprecated/clutter-input-device.h',
'deprecated/clutter-keysyms.h', 'deprecated/clutter-keysyms.h',
'deprecated/clutter-main.h', 'deprecated/clutter-main.h',
@ -259,7 +257,6 @@ clutter_deprecated_sources = [
'deprecated/clutter-behaviour-scale.c', 'deprecated/clutter-behaviour-scale.c',
'deprecated/clutter-box.c', 'deprecated/clutter-box.c',
'deprecated/clutter-cairo-texture.c', 'deprecated/clutter-cairo-texture.c',
'deprecated/clutter-group.c',
'deprecated/clutter-input-device-deprecated.c', 'deprecated/clutter-input-device-deprecated.c',
'deprecated/clutter-layout-manager-deprecated.c', 'deprecated/clutter-layout-manager-deprecated.c',
'deprecated/clutter-rectangle.c', 'deprecated/clutter-rectangle.c',
@ -370,7 +367,6 @@ cally_headers = [
'cally/cally-actor.h', 'cally/cally-actor.h',
'cally/cally-clone.h', 'cally/cally-clone.h',
'cally/cally-factory.h', 'cally/cally-factory.h',
'cally/cally-group.h',
'cally/cally.h', 'cally/cally.h',
'cally/cally-main.h', 'cally/cally-main.h',
'cally/cally-rectangle.h', 'cally/cally-rectangle.h',
@ -385,7 +381,6 @@ cally_sources = [
'cally/cally-actor.c', 'cally/cally-actor.c',
'cally/cally.c', 'cally/cally.c',
'cally/cally-clone.c', 'cally/cally-clone.c',
'cally/cally-group.c',
'cally/cally-rectangle.c', 'cally/cally-rectangle.c',
'cally/cally-root.c', 'cally/cally-root.c',
'cally/cally-stage.c', 'cally/cally-stage.c',

View File

@ -22,7 +22,6 @@
#ifndef __CLUTTER_STAGE_X11_H__ #ifndef __CLUTTER_STAGE_X11_H__
#define __CLUTTER_STAGE_X11_H__ #define __CLUTTER_STAGE_X11_H__
#include <clutter/clutter-group.h>
#include <clutter/clutter-stage.h> #include <clutter/clutter-stage.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>

View File

@ -72,7 +72,7 @@ main (int argc, char *argv[])
clutter_actor_set_size (button4, SIZE, SIZE); clutter_actor_set_size (button4, SIZE, SIZE);
for (i = 0; i < 4; i++) { 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_position (group[i], SIZE / 2, SIZE / 2);
clutter_actor_set_size (group[i], SIZE, SIZE); clutter_actor_set_size (group[i], SIZE, SIZE);

View File

@ -149,7 +149,7 @@ _create_button (const gchar *text)
ClutterActor *rectangle = NULL; ClutterActor *rectangle = NULL;
ClutterActor *label = NULL; ClutterActor *label = NULL;
button = clutter_group_new (); button = clutter_actor_new ();
rectangle = clutter_rectangle_new_with_color (CLUTTER_COLOR_Magenta); rectangle = clutter_rectangle_new_with_color (CLUTTER_COLOR_Magenta);
clutter_actor_set_size (rectangle, 375, 35); clutter_actor_set_size (rectangle, 375, 35);

View File

@ -209,7 +209,7 @@ make_ui (ClutterActor *stage)
clutter_container_add_actor (CLUTTER_CONTAINER (stage), text_editable_actor); clutter_container_add_actor (CLUTTER_CONTAINER (stage), text_editable_actor);
/* test button */ /* test button */
button = clutter_group_new (); button = clutter_actor_new ();
rectangle = clutter_rectangle_new_with_color (&color_rect); rectangle = clutter_rectangle_new_with_color (&color_rect);
clutter_actor_set_size (rectangle, 75, 35); clutter_actor_set_size (rectangle, 75, 35);

View File

@ -70,7 +70,7 @@ make_ui (ClutterActor *stage)
clutter_actor_set_position (rectangle, 150, 50); clutter_actor_set_position (rectangle, 150, 50);
clutter_actor_add_constraint (rectangle, clutter_bind_constraint_new (editable, CLUTTER_BIND_SIZE, 0)); 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_position (full_entry, 0, 50);
clutter_actor_set_size (full_entry, 100, 75); clutter_actor_set_size (full_entry, 100, 75);
clutter_container_add_actor (CLUTTER_CONTAINER (full_entry), label); clutter_container_add_actor (CLUTTER_CONTAINER (full_entry), label);

View File

@ -82,7 +82,7 @@ opacity_paint (void)
stage = clutter_test_get_stage (); stage = clutter_test_get_stage ();
group1 = clutter_group_new (); group1 = clutter_actor_new ();
clutter_actor_set_opacity (group1, 128); clutter_actor_set_opacity (group1, 128);
clutter_container_add (CLUTTER_CONTAINER (stage), group1, NULL); clutter_container_add (CLUTTER_CONTAINER (stage), group1, NULL);
clutter_actor_set_position (group1, 10, 30); clutter_actor_set_position (group1, 10, 30);
@ -109,7 +109,7 @@ opacity_paint (void)
clutter_actor_destroy (label); clutter_actor_destroy (label);
group2 = clutter_group_new (); group2 = clutter_actor_new ();
clutter_container_add (CLUTTER_CONTAINER (group1), group2, NULL); clutter_container_add (CLUTTER_CONTAINER (group1), group2, NULL);
clutter_actor_set_position (group2, 10, 60); clutter_actor_set_position (group2, 10, 60);

View File

@ -1,60 +0,0 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.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_depth (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_depth (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_depth (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)
)

View File

@ -42,7 +42,6 @@ clutter_conform_tests_general_tests = [
clutter_conform_tests_deprecated_tests = [ clutter_conform_tests_deprecated_tests = [
'animator', 'animator',
'behaviours', 'behaviours',
'group',
'rectangle', 'rectangle',
'texture', 'texture',
] ]

View File

@ -31,7 +31,7 @@ static ClutterActor *
create_source (void) create_source (void)
{ {
int x, y; int x, y;
ClutterActor *group = clutter_group_new (); ClutterActor *group = clutter_actor_new ();
/* Create a group with a different coloured rectangle at each /* Create a group with a different coloured rectangle at each
corner */ corner */

View File

@ -127,7 +127,7 @@ test_cogl_multitexture_main (int argc, char *argv[])
* default paint handler, so that we can easily control * default paint handler, so that we can easily control
* painting in a paint signal handler, without having to * painting in a paint signal handler, without having to
* sub-class anything etc. */ * 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); clutter_actor_set_position (state->group, stage_w / 2, stage_h / 2);
g_signal_connect (state->group, "paint", g_signal_connect (state->group, "paint",
G_CALLBACK(material_rectangle_paint), state); G_CALLBACK(material_rectangle_paint), state);

View File

@ -331,7 +331,7 @@ on_toggle_click (ClutterActor *button, ClutterEvent *event,
static ClutterActor * static ClutterActor *
make_toggle (const char *label_text, gboolean *toggle_val) 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 *label = clutter_text_new_with_text ("Sans 14", label_text);
ClutterActor *button = clutter_text_new_with_text ("Sans 14", ""); ClutterActor *button = clutter_text_new_with_text ("Sans 14", "");

View File

@ -317,7 +317,7 @@ create_dummy_actor (guint width, guint height)
ClutterActor *group, *rect; ClutterActor *group, *rect;
ClutterColor clr = { 0xff, 0xff, 0xff, 0xff}; ClutterColor clr = { 0xff, 0xff, 0xff, 0xff};
group = clutter_group_new (); group = clutter_actor_new ();
rect = clutter_rectangle_new_with_color (&clr); rect = clutter_rectangle_new_with_color (&clr);
clutter_actor_set_size (rect, width, height); clutter_actor_set_size (rect, width, height);
clutter_actor_hide (rect); clutter_actor_hide (rect);

View File

@ -496,7 +496,7 @@ test_events_main (int argc, char *argv[])
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "yellow box"); g_signal_connect (actor, "event", G_CALLBACK (input_cb), "yellow box");
/* note group not reactive */ /* 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 (group), actor, NULL);
clutter_container_add (CLUTTER_CONTAINER (stage), group, NULL); clutter_container_add (CLUTTER_CONTAINER (stage), group, NULL);
clutter_actor_set_position (group, 100, 350); clutter_actor_set_position (group, 100, 350);

View File

@ -17,7 +17,7 @@ make_source (void)
ClutterColor yellow = {0xff, 0xff, 0x00, 0xff}; ClutterColor yellow = {0xff, 0xff, 0x00, 0xff};
source = clutter_group_new (); source = clutter_actor_new ();
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL); file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
actor = clutter_texture_new_from_file (file, &error); actor = clutter_texture_new_from_file (file, &error);

View File

@ -271,7 +271,7 @@ test_paint_wrapper_main (int argc, char *argv[])
} }
/* create a new group to hold multiple actors in a group */ /* 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); oh->hand = g_new (ClutterActor*, n_hands);

View File

@ -257,7 +257,7 @@ test_pixmap_main (int argc, char **argv)
if (!disable_x11) if (!disable_x11)
{ {
group = clutter_group_new (); group = clutter_actor_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
label = clutter_text_new_with_text ("fixed", label = clutter_text_new_with_text ("fixed",
"ClutterX11Texture (Window)"); "ClutterX11Texture (Window)");
@ -289,7 +289,7 @@ test_pixmap_main (int argc, char **argv)
XDrawLine (xdpy, win_remote, gc, 0+i*20, 0, 10+i*20+i, 200); XDrawLine (xdpy, win_remote, gc, 0+i*20, 0, 10+i*20+i, 200);
group = clutter_group_new (); group = clutter_actor_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
label = clutter_text_new_with_text ("fixed", "ClutterX11Texture (Pixmap)"); label = clutter_text_new_with_text ("fixed", "ClutterX11Texture (Pixmap)");
clutter_container_add_actor (CLUTTER_CONTAINER (group), label); clutter_container_add_actor (CLUTTER_CONTAINER (group), label);

View File

@ -56,7 +56,7 @@ main (int argc, char *argv[])
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black); clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Text"); 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_actor_set_size (group, STAGE_WIDTH, STAGE_WIDTH);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);

View File

@ -37,7 +37,7 @@ static ClutterActor *new_rect (gint r,
gint a) gint a)
{ {
ClutterColor *color = clutter_color_new (r, g, b, a); ClutterColor *color = clutter_color_new (r, g, b, a);
ClutterActor *group = clutter_group_new (); ClutterActor *group = clutter_actor_new ();
ClutterActor *rectangle = clutter_rectangle_new_with_color (color); ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
gchar *file = g_build_filename (TESTS_DATA_DIR, "redhand.png", NULL); gchar *file = g_build_filename (TESTS_DATA_DIR, "redhand.png", NULL);
@ -63,7 +63,7 @@ main (gint argc,
g_error ("Failed to initialize Clutter"); g_error ("Failed to initialize Clutter");
stage = clutter_stage_new (); stage = clutter_stage_new ();
group = clutter_group_new (); group = clutter_actor_new ();
layout_state = clutter_state_new (); layout_state = clutter_state_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Performance [hidden]"); clutter_stage_set_title (CLUTTER_STAGE (stage), "State Performance [hidden]");
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black); clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);

View File

@ -71,7 +71,7 @@ static ClutterActor *new_rect (gint r,
{ {
GError *error = NULL; GError *error = NULL;
ClutterColor *color = clutter_color_new (r, g, b, a); ClutterColor *color = clutter_color_new (r, g, b, a);
ClutterActor *group = clutter_group_new (); ClutterActor *group = clutter_actor_new ();
ClutterActor *rectangle = clutter_rectangle_new_with_color (color); ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
ClutterActor *hand = NULL; ClutterActor *hand = NULL;

View File

@ -38,7 +38,7 @@ static ClutterActor *new_rect (gint r,
{ {
GError *error = NULL; GError *error = NULL;
ClutterColor *color = clutter_color_new (r, g, b, a); ClutterColor *color = clutter_color_new (r, g, b, a);
ClutterActor *group = clutter_group_new (); ClutterActor *group = clutter_actor_new ();
ClutterActor *rectangle = clutter_rectangle_new_with_color (color); ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
ClutterActor *hand = NULL; ClutterActor *hand = NULL;

View File

@ -43,7 +43,7 @@ static ClutterActor *new_rect (gint r,
{ {
GError *error = NULL; GError *error = NULL;
ClutterColor *color = clutter_color_new (r, g, b, a); ClutterColor *color = clutter_color_new (r, g, b, a);
ClutterActor *group = clutter_group_new (); ClutterActor *group = clutter_actor_new ();
ClutterActor *rectangle = clutter_rectangle_new_with_color (color); ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
ClutterActor *hand = NULL; ClutterActor *hand = NULL;

View File

@ -43,7 +43,7 @@ static ClutterActor *new_rect (gint r,
{ {
GError *error = NULL; GError *error = NULL;
ClutterColor *color = clutter_color_new (r, g, b, a); ClutterColor *color = clutter_color_new (r, g, b, a);
ClutterActor *group = clutter_group_new (); ClutterActor *group = clutter_actor_new ();
ClutterActor *rectangle = clutter_rectangle_new_with_color (color); ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
ClutterActor *hand = NULL; ClutterActor *hand = NULL;

View File

@ -231,7 +231,7 @@ test_materials (TestUtilsGTestFixture *fixture,
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_actor_get_geometry (stage, &state.stage_geom); clutter_actor_get_geometry (stage, &state.stage_geom);
group = clutter_group_new (); group = clutter_actor_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
/* We force continuous redrawing of the stage, since we need to skip /* We force continuous redrawing of the stage, since we need to skip

View File

@ -185,7 +185,7 @@ test_multitexture (TestUtilsGTestFixture *fixture,
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); 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); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
/* We force continuous redrawing incase someone comments out the /* We force continuous redrawing incase someone comments out the

View File

@ -115,7 +115,7 @@ test_texture_mipmaps (TestUtilsGTestFixture *fixture,
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); 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); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
/* We force continuous redrawing of the stage, since we need to skip /* We force continuous redrawing of the stage, since we need to skip

View File

@ -172,7 +172,7 @@ test_vertex_buffer_contiguous (TestUtilsGTestFixture *fixture,
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
clutter_actor_get_geometry (stage, &state.stage_geom); clutter_actor_get_geometry (stage, &state.stage_geom);
group = clutter_group_new (); group = clutter_actor_new ();
clutter_actor_set_size (group, clutter_actor_set_size (group,
state.stage_geom.width, state.stage_geom.width,
state.stage_geom.height); state.stage_geom.height);

View File

@ -97,7 +97,7 @@ test_vertex_buffer_interleved (TestUtilsGTestFixture *fixture,
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
clutter_actor_get_geometry (stage, &state.stage_geom); clutter_actor_get_geometry (stage, &state.stage_geom);
group = clutter_group_new (); group = clutter_actor_new ();
clutter_actor_set_size (group, clutter_actor_set_size (group,
state.stage_geom.width, state.stage_geom.width,
state.stage_geom.height); state.stage_geom.height);

View File

@ -140,7 +140,7 @@ test_vertex_buffer_mutability (TestUtilsGTestFixture *fixture,
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
clutter_actor_get_geometry (stage, &state.stage_geom); clutter_actor_get_geometry (stage, &state.stage_geom);
group = clutter_group_new (); group = clutter_actor_new ();
clutter_actor_set_size (group, clutter_actor_set_size (group,
state.stage_geom.width, state.stage_geom.width,
state.stage_geom.height); state.stage_geom.height);

View File

@ -29,7 +29,7 @@
#include "meta/compositor.h" #include "meta/compositor.h"
/* /*
* MetaWindowActor object (ClutterGroup sub-class) * MetaWindowActor object (ClutterActor sub-class)
*/ */
#define META_TYPE_WINDOW_ACTOR (meta_window_actor_get_type ()) #define META_TYPE_WINDOW_ACTOR (meta_window_actor_get_type ())
#define META_WINDOW_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_WINDOW_ACTOR, MetaWindowActor)) #define META_WINDOW_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_WINDOW_ACTOR, MetaWindowActor))