Compare commits

...

6 Commits

Author SHA1 Message Date
5f1410f968 clutter: remove deprecated ClutterStage/ClutterAnimator
Removing one without the other was quite the headache, so just remove
both of them together instead.
2018-11-18 11:52:50 +01:00
156aa3dd99 Clutter: remove deprecated ClutterBox 2018-11-18 11:26:03 +01:00
b590c90e90 clutter: Remove deprecated ClutterTableLayout 2018-11-17 14:51:05 +01:00
a8ee0d8b80 clutter: Remove deprecated ClutterGroup 2018-11-17 13:51:24 +01:00
19137361d7 clutter: remove deprecated ClutterShader 2018-11-17 13:51:24 +01:00
1c7472b24d clutter: remove unused deprecated types
They weren't being used anywhere, so they can be easily removed without
going into other files.
2018-11-17 13:51:24 +01:00
110 changed files with 85 additions and 21280 deletions

View File

@ -78,7 +78,6 @@ source_h = \
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 \
@ -258,7 +257,6 @@ deprecated_h = \
deprecated/clutter-alpha.h \
deprecated/clutter-animatable.h \
deprecated/clutter-animation.h \
deprecated/clutter-animator.h \
deprecated/clutter-backend.h \
deprecated/clutter-behaviour.h \
deprecated/clutter-behaviour-depth.h \
@ -268,27 +266,16 @@ deprecated_h = \
deprecated/clutter-behaviour-rotate.h \
deprecated/clutter-behaviour-scale.h \
deprecated/clutter-bin-layout.h \
deprecated/clutter-box.h \
deprecated/clutter-cairo-texture.h \
deprecated/clutter-container.h \
deprecated/clutter-frame-source.h \
deprecated/clutter-group.h \
deprecated/clutter-input-device.h \
deprecated/clutter-keysyms.h \
deprecated/clutter-list-model.h \
deprecated/clutter-main.h \
deprecated/clutter-media.h \
deprecated/clutter-model.h \
deprecated/clutter-rectangle.h \
deprecated/clutter-score.h \
deprecated/clutter-shader.h \
deprecated/clutter-stage-manager.h \
deprecated/clutter-stage.h \
deprecated/clutter-state.h \
deprecated/clutter-table-layout.h \
deprecated/clutter-texture.h \
deprecated/clutter-timeline.h \
deprecated/clutter-timeout-pool.h \
deprecated/clutter-util.h \
$(NULL)
@ -297,7 +284,6 @@ deprecated_c = \
deprecated/clutter-actor-deprecated.c \
deprecated/clutter-alpha.c \
deprecated/clutter-animation.c \
deprecated/clutter-animator.c \
deprecated/clutter-behaviour.c \
deprecated/clutter-behaviour-depth.c \
deprecated/clutter-behaviour-ellipse.c \
@ -305,33 +291,11 @@ deprecated_c = \
deprecated/clutter-behaviour-path.c \
deprecated/clutter-behaviour-rotate.c \
deprecated/clutter-behaviour-scale.c \
deprecated/clutter-box.c \
deprecated/clutter-cairo-texture.c \
deprecated/clutter-frame-source.c \
deprecated/clutter-group.c \
deprecated/clutter-input-device-deprecated.c \
deprecated/clutter-layout-manager-deprecated.c \
deprecated/clutter-list-model.c \
deprecated/clutter-media.c \
deprecated/clutter-model.c \
deprecated/clutter-rectangle.c \
deprecated/clutter-score.c \
deprecated/clutter-shader.c \
deprecated/clutter-state.c \
deprecated/clutter-table-layout.c \
deprecated/clutter-texture.c \
deprecated/clutter-timeout-pool.c \
$(NULL)
# deprecated private headers; these should not be installed
deprecated_h_priv = \
deprecated/clutter-model-private.h \
deprecated/clutter-timeout-interval.h \
$(NULL)
# deprecated private source code; these should not be introspected
deprecated_c_priv = \
deprecated/clutter-timeout-interval.c \
$(NULL)
# built sources
@ -595,8 +559,6 @@ libmutter_clutter_@LIBMUTTER_API_VERSION@_la_SOURCES = \
$(source_h_priv) \
$(deprecated_c) \
$(deprecated_h) \
$(deprecated_c_priv) \
$(deprecated_h_priv) \
$(cally_sources_c) \
$(cally_sources_h) \
$(cally_sources_private) \

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,
cally_stage,
CALLY_TYPE_GROUP,
CALLY_TYPE_ACTOR,
G_ADD_PRIVATE (CallyStage)
G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW,
cally_stage_window_interface_init));

View File

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

View File

@ -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-texture.h"
@ -53,7 +52,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_TEXTURE, cally_texture, cally_texture_new)
@ -75,7 +73,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_TEXTURE, cally_texture);

View File

@ -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"

View File

@ -1108,7 +1108,6 @@ static void clutter_actor_pop_in_cloned_branch (ClutterActor *self,
{ _transform; } \
cogl_matrix_translate ((m), -_tx, -_ty, -_tz); } G_STMT_END
static GQuark quark_shader_data = 0;
static GQuark quark_actor_layout_info = 0;
static GQuark quark_actor_transform_info = 0;
static GQuark quark_actor_animation_info = 0;
@ -3522,12 +3521,6 @@ _clutter_actor_update_last_paint_volume (ClutterActor *self)
priv->last_paint_volume_valid = TRUE;
}
static inline gboolean
actor_has_shader_data (ClutterActor *self)
{
return g_object_get_qdata (G_OBJECT (self), quark_shader_data) != NULL;
}
guint32
_clutter_actor_get_pick_id (ClutterActor *self)
{
@ -3769,7 +3762,6 @@ clutter_actor_paint (ClutterActor *self)
ClutterActorPrivate *priv;
ClutterPickMode pick_mode;
gboolean clip_set = FALSE;
gboolean shader_applied = FALSE;
ClutterStage *stage;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
@ -3940,13 +3932,6 @@ clutter_actor_paint (ClutterActor *self)
if (priv->effects == NULL)
{
if (pick_mode == CLUTTER_PICK_NONE &&
actor_has_shader_data (self))
{
_clutter_actor_shader_pre_paint (self, FALSE);
shader_applied = TRUE;
}
priv->next_effect_to_paint = NULL;
}
else
@ -3955,9 +3940,6 @@ clutter_actor_paint (ClutterActor *self)
clutter_actor_continue_paint (self);
if (shader_applied)
_clutter_actor_shader_post_paint (self);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES &&
pick_mode == CLUTTER_PICK_NONE))
_clutter_actor_draw_paint_volume (self);
@ -6297,7 +6279,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
quark_shader_data = g_quark_from_static_string ("-clutter-actor-shader-data");
quark_actor_layout_info = g_quark_from_static_string ("-clutter-actor-layout-info");
quark_actor_transform_info = g_quark_from_static_string ("-clutter-actor-transform-info");
quark_actor_animation_info = g_quark_from_static_string ("-clutter-actor-animation-info");

View File

@ -43,7 +43,7 @@
*
* Constraints can be used with fixed layout managers, like
* #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
* relations between #ClutterActors, without explicit fixed

View File

@ -7,7 +7,6 @@
#include "deprecated/clutter-alpha.h"
#include "deprecated/clutter-animatable.h"
#include "deprecated/clutter-animation.h"
#include "deprecated/clutter-animator.h"
#include "deprecated/clutter-backend.h"
#include "deprecated/clutter-behaviour.h"
#include "deprecated/clutter-behaviour-depth.h"
@ -17,27 +16,16 @@
#include "deprecated/clutter-behaviour-rotate.h"
#include "deprecated/clutter-behaviour-scale.h"
#include "deprecated/clutter-bin-layout.h"
#include "deprecated/clutter-box.h"
#include "deprecated/clutter-cairo-texture.h"
#include "deprecated/clutter-container.h"
#include "deprecated/clutter-frame-source.h"
#include "deprecated/clutter-group.h"
#include "deprecated/clutter-input-device.h"
#include "deprecated/clutter-keysyms.h"
#include "deprecated/clutter-list-model.h"
#include "deprecated/clutter-main.h"
#include "deprecated/clutter-media.h"
#include "deprecated/clutter-model.h"
#include "deprecated/clutter-rectangle.h"
#include "deprecated/clutter-score.h"
#include "deprecated/clutter-shader.h"
#include "deprecated/clutter-stage-manager.h"
#include "deprecated/clutter-stage.h"
#include "deprecated/clutter-state.h"
#include "deprecated/clutter-table-layout.h"
#include "deprecated/clutter-texture.h"
#include "deprecated/clutter-timeline.h"
#include "deprecated/clutter-timeout-pool.h"
#include "deprecated/clutter-util.h"
#undef __CLUTTER_DEPRECATED_H_INSIDE__

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

@ -157,49 +157,6 @@
* respectively) and the "object" string member for calling
* g_signal_connect_object() instead of g_signal_connect().
*
* Signals can also be directly attached to a specific state defined
* inside a #ClutterState instance, for instance:
*
* |[
* ...
* "signals" : [
* {
* "name" : "enter-event",
* "states" : "button-states",
* "target-state" : "hover"
* },
* {
* "name" : "leave-event",
* "states" : "button-states",
* "target-state" : "base"
* },
* {
* "name" : "button-press-event",
* "states" : "button-states",
* "target-state" : "active",
* },
* {
* "name" : "key-press-event",
* "states" : "button-states",
* "target-state" : "key-focus",
* "warp" : true
* }
* ],
* ...
* ]|
*
* The "states" key defines the #ClutterState instance to be used to
* resolve the "target-state" key; it can be either a script id for a
* #ClutterState built by the same #ClutterScript instance, or to a
* #ClutterState built in code and associated to the #ClutterScript
* instance through the clutter_script_add_states() function. If no
* "states" key is present, then the default #ClutterState associated to
* the #ClutterScript instance will be used; the default #ClutterState
* can be set using clutter_script_add_states() using a %NULL name. The
* "warp" key can be used to warp to a specific state instead of
* animating to it. State changes on signal emission will not affect
* the signal emission chain.
*
* Clutter reserves the following names, so classes defining properties
* through the usual GObject registration process should avoid using these
* names to avoid collisions:
@ -248,7 +205,6 @@
#include "deprecated/clutter-alpha.h"
#include "deprecated/clutter-behaviour.h"
#include "deprecated/clutter-container.h"
#include "deprecated/clutter-state.h"
enum
{
@ -274,8 +230,6 @@ struct _ClutterScriptPrivate
ClutterScriptParser *parser;
GHashTable *states;
gchar **search_paths;
gchar *translation_domain;
@ -328,7 +282,6 @@ signal_info_free (gpointer data)
g_free (sinfo->name);
g_free (sinfo->handler);
g_free (sinfo->object);
g_free (sinfo->state);
g_free (sinfo->target);
g_slice_free (SignalInfo, sinfo);
@ -386,7 +339,6 @@ clutter_script_finalize (GObject *gobject)
g_hash_table_destroy (priv->objects);
g_strfreev (priv->search_paths);
g_free (priv->filename);
g_hash_table_destroy (priv->states);
g_free (priv->translation_domain);
G_OBJECT_CLASS (clutter_script_parent_class)->finalize (gobject);
@ -521,9 +473,6 @@ clutter_script_init (ClutterScript *script)
priv->objects = g_hash_table_new_full (g_str_hash, g_str_equal,
NULL,
object_info_free);
priv->states = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free,
(GDestroyNotify) g_object_unref);
}
/**
@ -1043,65 +992,12 @@ clutter_script_connect_signals (ClutterScript *script,
g_free (cd);
}
typedef struct {
ClutterState *state;
GObject *emitter;
gchar *target;
gulong signal_id;
gulong hook_id;
gboolean warp_to;
} HookData;
typedef struct {
ClutterScript *script;
ClutterScriptConnectFunc func;
gpointer user_data;
} SignalConnectData;
static void
hook_data_free (gpointer data)
{
if (G_LIKELY (data != NULL))
{
HookData *hook_data = data;
g_free (hook_data->target);
g_slice_free (HookData, hook_data);
}
}
static gboolean
clutter_script_state_change_hook (GSignalInvocationHint *ihint,
guint n_params,
const GValue *params,
gpointer user_data)
{
HookData *hook_data = user_data;
GObject *emitter;
emitter = g_value_get_object (&params[0]);
if (emitter == hook_data->emitter)
{
if (hook_data->warp_to)
clutter_state_warp_to_state (hook_data->state, hook_data->target);
else
clutter_state_set_state (hook_data->state, hook_data->target);
}
return TRUE;
}
static void
clutter_script_remove_state_change_hook (gpointer user_data,
GObject *object_p)
{
HookData *hook_data = user_data;
g_signal_remove_emission_hook (hook_data->signal_id,
hook_data->hook_id);
}
static void
connect_each_object (gpointer key,
gpointer value,
@ -1139,67 +1035,6 @@ connect_each_object (gpointer key,
connect_data->user_data);
}
}
else
{
GObject *state_object = NULL;
const gchar *signal_name, *signal_detail;
gchar **components;
GQuark signal_quark;
guint signal_id;
HookData *hook_data;
if (sinfo->state == NULL)
state_object = (GObject *) clutter_script_get_states (script, NULL);
else
{
state_object = clutter_script_get_object (script, sinfo->state);
if (state_object == NULL)
state_object = (GObject *) clutter_script_get_states (script, sinfo->state);
}
if (state_object == NULL)
continue;
components = g_strsplit (sinfo->name, "::", 2);
if (g_strv_length (components) == 2)
{
signal_name = components[0];
signal_detail = components[1];
}
else
{
signal_name = components[0];
signal_detail = NULL;
}
signal_id = g_signal_lookup (signal_name, G_OBJECT_TYPE (object));
if (signal_id == 0)
{
g_strfreev (components);
continue;
}
if (signal_detail != NULL)
signal_quark = g_quark_from_string (signal_detail);
else
signal_quark = 0;
hook_data = g_slice_new (HookData);
hook_data->emitter = object;
hook_data->state = CLUTTER_STATE (state_object);
hook_data->target = g_strdup (sinfo->target);
hook_data->warp_to = sinfo->warp_to;
hook_data->signal_id = signal_id;
hook_data->hook_id =
g_signal_add_emission_hook (signal_id, signal_quark,
clutter_script_state_change_hook,
hook_data,
hook_data_free);
g_object_weak_ref (hook_data->emitter,
clutter_script_remove_state_change_hook,
hook_data);
}
signal_info_free (sinfo);
}
@ -1423,72 +1258,6 @@ clutter_script_list_objects (ClutterScript *script)
return retval;
}
/**
* clutter_script_add_states:
* @script: a #ClutterScript
* @name: (allow-none): a name for the @state, or %NULL to
* set the default #ClutterState
* @state: a #ClutterState
*
* Associates a #ClutterState to the #ClutterScript instance using the given
* name.
*
* The #ClutterScript instance will use @state to resolve target states when
* connecting signal handlers.
*
* The #ClutterScript instance will take a reference on the #ClutterState
* passed to this function.
*
* Since: 1.8
*
* Deprecated: 1.12
*/
void
clutter_script_add_states (ClutterScript *script,
const gchar *name,
ClutterState *state)
{
g_return_if_fail (CLUTTER_IS_SCRIPT (script));
g_return_if_fail (CLUTTER_IS_STATE (state));
if (name == NULL || *name == '\0')
name = "__clutter_script_default_state";
g_hash_table_replace (script->priv->states,
g_strdup (name),
g_object_ref (state));
}
/**
* clutter_script_get_states:
* @script: a #ClutterScript
* @name: (allow-none): the name of the #ClutterState, or %NULL
*
* Retrieves the #ClutterState for the given @state_name.
*
* If @name is %NULL, this function will return the default
* #ClutterState instance.
*
* Return value: (transfer none): a pointer to the #ClutterState for the
* given name. The #ClutterState is owned by the #ClutterScript instance
* and it should not be unreferenced
*
* Since: 1.8
*
* Deprecated: 1.12
*/
ClutterState *
clutter_script_get_states (ClutterScript *script,
const gchar *name)
{
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), NULL);
if (name == NULL || *name == '\0')
name = "__clutter_script_default_state";
return g_hash_table_lookup (script->priv->states, name);
}
/**
* clutter_script_set_translation_domain:
* @script: a #ClutterScript

View File

@ -178,15 +178,6 @@ void clutter_script_unmerge_objects (ClutterScript
CLUTTER_EXPORT
void clutter_script_ensure_objects (ClutterScript *script);
CLUTTER_DEPRECATED
void clutter_script_add_states (ClutterScript *script,
const gchar *name,
ClutterState *state);
CLUTTER_DEPRECATED
ClutterState * clutter_script_get_states (ClutterScript *script,
const gchar *name);
CLUTTER_EXPORT
void clutter_script_connect_signals (ClutterScript *script,
gpointer user_data);

View File

@ -204,7 +204,7 @@ static void free_queue_redraw_entry (ClutterStageQueueRedrawEntry *entry);
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_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
clutter_container_iface_init))
@ -685,10 +685,6 @@ _clutter_stage_paint_view (ClutterStage *stage,
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
clutter_stage_paint (ClutterActor *self)
{
@ -707,9 +703,9 @@ clutter_stage_pick (ClutterActor *self,
ClutterActorIter iter;
ClutterActor *child;
/* Note: we don't chain up to our parent as we don't want any geometry
* emitted for the stage itself. The stage's pick id is effectively handled
* by the call to cogl_clear done in clutter-main.c:_clutter_do_pick_async()
/* Note: we don't want any geometry emitted for the stage itself. The stage's
* pick id is effectively handled by the call to cogl_clear done in
* clutter-main.c:_clutter_do_pick_async()
*/
clutter_actor_iter_init (&iter, self);
while (clutter_actor_iter_next (&iter, &child))
@ -756,9 +752,6 @@ clutter_stage_show_all (ClutterActor *self)
ClutterActorIter iter;
ClutterActor *child;
/* we don't do a recursive show_all(), to maintain the old
* invariants from ClutterGroup
*/
clutter_actor_iter_init (&iter, self);
while (clutter_actor_iter_next (&iter, &child))
clutter_actor_show (child);
@ -789,9 +782,6 @@ clutter_stage_hide_all (ClutterActor *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);
while (clutter_actor_iter_next (&iter, &child))
clutter_actor_hide (child);

View File

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

View File

@ -24,7 +24,7 @@
/**
* SECTION:clutter-timeline
* @short_description: A class for time-based events
* @see_also: #ClutterAnimation, #ClutterAnimator, #ClutterState
* @see_also: #ClutterAnimation
*
* #ClutterTimeline is a base class for managing time-based event that cause
* Clutter to redraw a stage, such as animations.
@ -71,7 +71,7 @@
* when reaching completion by using the #ClutterTimeline:auto-reverse property.
*
* Timelines are used in the Clutter animation framework by classes like
* #ClutterAnimation, #ClutterAnimator, and #ClutterState.
* #ClutterAnimation.
*
* ## Defining Timelines in ClutterScript
*

View File

@ -90,8 +90,6 @@ typedef struct _ClutterVertex ClutterVertex;
typedef struct _ClutterAlpha ClutterAlpha;
typedef struct _ClutterAnimation ClutterAnimation;
typedef struct _ClutterAnimator ClutterAnimator;
typedef struct _ClutterState ClutterState;
typedef struct _ClutterInputDeviceTool ClutterInputDeviceTool;
typedef struct _ClutterInputDevice ClutterInputDevice;
@ -116,7 +114,6 @@ typedef struct _ClutterEventSequence ClutterEventSequence;
typedef struct _ClutterFog ClutterFog; /* deprecated */
typedef struct _ClutterBehaviour ClutterBehaviour; /* deprecated */
typedef struct _ClutterShader ClutterShader; /* deprecated */
/**
* ClutterPaintVolume:

View File

@ -68,7 +68,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"

View File

@ -7,314 +7,6 @@
#include "clutter-actor-private.h"
#include "clutter-private.h"
#include "clutter-shader.h"
typedef struct _ShaderData ShaderData;
struct _ShaderData
{
ClutterShader *shader;
/* back pointer to the actor */
ClutterActor *actor;
/* list of values that should be set on the shader
* before each paint cycle
*/
GHashTable *value_hash;
};
static void
shader_value_free (gpointer data)
{
GValue *var = data;
g_value_unset (var);
g_slice_free (GValue, var);
}
static void
destroy_shader_data (gpointer data)
{
ShaderData *shader_data = data;
if (shader_data == NULL)
return;
if (shader_data->shader != NULL)
{
g_object_unref (shader_data->shader);
shader_data->shader = NULL;
}
if (shader_data->value_hash != NULL)
{
g_hash_table_destroy (shader_data->value_hash);
shader_data->value_hash = NULL;
}
g_slice_free (ShaderData, shader_data);
}
/**
* clutter_actor_get_shader:
* @self: a #ClutterActor
*
* Queries the currently set #ClutterShader on @self.
*
* Return value: (transfer none): The currently set #ClutterShader
* or %NULL if no shader is set.
*
* Since: 0.6
*
* Deprecated: 1.8: Use clutter_actor_get_effect() instead.
*/
ClutterShader *
clutter_actor_get_shader (ClutterActor *self)
{
ShaderData *shader_data;
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
shader_data = g_object_get_data (G_OBJECT (self), "-clutter-actor-shader-data");
if (shader_data != NULL)
return shader_data->shader;
return NULL;
}
/**
* clutter_actor_set_shader:
* @self: a #ClutterActor
* @shader: (allow-none): a #ClutterShader or %NULL to unset the shader.
*
* Sets the #ClutterShader to be used when rendering @self.
*
* If @shader is %NULL this function will unset any currently set shader
* for the actor.
*
* Any #ClutterEffect applied to @self will take the precedence
* over the #ClutterShader set using this function.
*
* Return value: %TRUE if the shader was successfully applied
* or removed
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffect and
* clutter_actor_add_effect() instead.
*/
gboolean
clutter_actor_set_shader (ClutterActor *self,
ClutterShader *shader)
{
ShaderData *shader_data;
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
g_return_val_if_fail (shader == NULL || CLUTTER_IS_SHADER (shader), FALSE);
if (shader != NULL)
g_object_ref (shader);
else
{
/* if shader passed in is NULL we destroy the shader */
g_object_set_data (G_OBJECT (self), "-clutter-actor-shader-data", NULL);
return TRUE;
}
shader_data = g_object_get_data (G_OBJECT (self), "-clutter-actor-shader-data");
if (shader_data == NULL)
{
shader_data = g_slice_new (ShaderData);
shader_data->actor = self;
shader_data->shader = NULL;
shader_data->value_hash =
g_hash_table_new_full (g_str_hash, g_str_equal,
g_free,
shader_value_free);
g_object_set_data_full (G_OBJECT (self), "-clutter-actor-shader-data",
shader_data,
destroy_shader_data);
}
if (shader_data->shader != NULL)
g_object_unref (shader_data->shader);
shader_data->shader = shader;
clutter_actor_queue_redraw (self);
return TRUE;
}
static void
set_each_param (gpointer key,
gpointer value,
gpointer user_data)
{
ClutterShader *shader = user_data;
const gchar *uniform = key;
GValue *var = value;
clutter_shader_set_uniform (shader, uniform, var);
}
void
_clutter_actor_shader_pre_paint (ClutterActor *actor,
gboolean repeat)
{
ShaderData *shader_data;
ClutterShader *shader;
shader_data = g_object_get_data (G_OBJECT (actor), "-clutter-actor-shader-data");
if (shader_data == NULL)
return;
shader = shader_data->shader;
if (shader != NULL)
{
clutter_shader_set_is_enabled (shader, TRUE);
g_hash_table_foreach (shader_data->value_hash, set_each_param, shader);
if (!repeat)
_clutter_context_push_shader_stack (actor);
}
}
void
_clutter_actor_shader_post_paint (ClutterActor *actor)
{
ShaderData *shader_data;
ClutterShader *shader;
shader_data = g_object_get_data (G_OBJECT (actor), "-clutter-actor-shader-data");
if (G_LIKELY (shader_data == NULL))
return;
shader = shader_data->shader;
if (shader != NULL)
{
ClutterActor *head;
clutter_shader_set_is_enabled (shader, FALSE);
/* remove the actor from the shaders stack; if there is another
* actor inside it, then call pre-paint again to set its shader
* but this time with the second argument being TRUE, indicating
* that we are re-applying an existing shader and thus should it
* not be prepended to the stack
*/
head = _clutter_context_pop_shader_stack (actor);
if (head != NULL)
_clutter_actor_shader_pre_paint (head, TRUE);
}
}
static inline void
clutter_actor_set_shader_param_internal (ClutterActor *self,
const gchar *param,
const GValue *value)
{
ShaderData *shader_data;
GValue *var;
shader_data = g_object_get_data (G_OBJECT (self), "-clutter-actor-shader-data");
if (shader_data == NULL)
return;
var = g_slice_new0 (GValue);
g_value_init (var, G_VALUE_TYPE (value));
g_value_copy (value, var);
g_hash_table_insert (shader_data->value_hash, g_strdup (param), var);
clutter_actor_queue_redraw (self);
}
/**
* clutter_actor_set_shader_param:
* @self: a #ClutterActor
* @param: the name of the parameter
* @value: the value of the parameter
*
* Sets the value for a named parameter of the shader applied
* to @actor.
*
* Since: 1.0
*
* Deprecated: 1.8: Use clutter_shader_effect_set_uniform_value() instead
*/
void
clutter_actor_set_shader_param (ClutterActor *self,
const gchar *param,
const GValue *value)
{
g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_return_if_fail (param != NULL);
g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value) ||
CLUTTER_VALUE_HOLDS_SHADER_INT (value) ||
CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value) ||
G_VALUE_HOLDS_FLOAT (value) ||
G_VALUE_HOLDS_INT (value));
clutter_actor_set_shader_param_internal (self, param, value);
}
/**
* clutter_actor_set_shader_param_float:
* @self: a #ClutterActor
* @param: the name of the parameter
* @value: the value of the parameter
*
* Sets the value for a named float parameter of the shader applied
* to @actor.
*
* Since: 0.8
*
* Deprecated: 1.8: Use clutter_shader_effect_set_uniform() instead
*/
void
clutter_actor_set_shader_param_float (ClutterActor *self,
const gchar *param,
gfloat value)
{
GValue var = { 0, };
g_value_init (&var, G_TYPE_FLOAT);
g_value_set_float (&var, value);
clutter_actor_set_shader_param_internal (self, param, &var);
g_value_unset (&var);
}
/**
* clutter_actor_set_shader_param_int:
* @self: a #ClutterActor
* @param: the name of the parameter
* @value: the value of the parameter
*
* Sets the value for a named int parameter of the shader applied to
* @actor.
*
* Since: 0.8
*
* Deprecated: 1.8: Use clutter_shader_effect_set_uniform() instead
*/
void
clutter_actor_set_shader_param_int (ClutterActor *self,
const gchar *param,
gint value)
{
GValue var = { 0, };
g_value_init (&var, G_TYPE_INT);
g_value_set_int (&var, value);
clutter_actor_set_shader_param_internal (self, param, &var);
g_value_unset (&var);
}
/**
* clutter_actor_set_geometry:

File diff suppressed because it is too large Load Diff

View File

@ -1,188 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2010 Intel Corporation
*
* 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/>.
*
* Author:
* Øyvind Kolås <pippin@linux.intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_ANIMATOR_H__
#define __CLUTTER_ANIMATOR_H__
#include <clutter/clutter-types.h>
#include <clutter/clutter-timeline.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_ANIMATOR (clutter_animator_get_type ())
#define CLUTTER_TYPE_ANIMATOR_KEY (clutter_animator_key_get_type ())
#define CLUTTER_ANIMATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ANIMATOR, ClutterAnimator))
#define CLUTTER_ANIMATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ANIMATOR, ClutterAnimatorClass))
#define CLUTTER_IS_ANIMATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ANIMATOR))
#define CLUTTER_IS_ANIMATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ANIMATOR))
#define CLUTTER_ANIMATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ANIMATOR, ClutterAnimatorClass))
/* ClutterAnimator is typedef in clutter-types.h */
typedef struct _ClutterAnimatorClass ClutterAnimatorClass;
typedef struct _ClutterAnimatorPrivate ClutterAnimatorPrivate;
/**
* ClutterAnimatorKey:
*
* A key frame inside a #ClutterAnimator
*
* Since: 1.2
*
* Deprecated: 1.12
*/
typedef struct _ClutterAnimatorKey ClutterAnimatorKey;
/**
* ClutterAnimator:
*
* The #ClutterAnimator structure contains only private data and
* should be accessed using the provided API
*
* Since: 1.2
*
* Deprecated: 1.12
*/
struct _ClutterAnimator
{
/*< private >*/
GObject parent_instance;
ClutterAnimatorPrivate *priv;
};
/**
* ClutterAnimatorClass:
*
* The #ClutterAnimatorClass structure contains only private data
*
* Since: 1.2
*
* Deprecated: 1.12
*/
struct _ClutterAnimatorClass
{
/*< private >*/
GObjectClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[16];
};
CLUTTER_DEPRECATED
GType clutter_animator_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
ClutterAnimator * clutter_animator_new (void);
CLUTTER_DEPRECATED
ClutterAnimator * clutter_animator_set_key (ClutterAnimator *animator,
GObject *object,
const gchar *property_name,
guint mode,
gdouble progress,
const GValue *value);
CLUTTER_DEPRECATED
void clutter_animator_set (ClutterAnimator *animator,
gpointer first_object,
const gchar *first_property_name,
guint first_mode,
gdouble first_progress,
...) G_GNUC_NULL_TERMINATED;
CLUTTER_DEPRECATED
GList * clutter_animator_get_keys (ClutterAnimator *animator,
GObject *object,
const gchar *property_name,
gdouble progress);
CLUTTER_DEPRECATED
void clutter_animator_remove_key (ClutterAnimator *animator,
GObject *object,
const gchar *property_name,
gdouble progress);
CLUTTER_DEPRECATED
ClutterTimeline * clutter_animator_start (ClutterAnimator *animator);
CLUTTER_DEPRECATED
gboolean clutter_animator_compute_value (ClutterAnimator *animator,
GObject *object,
const gchar *property_name,
gdouble progress,
GValue *value);
CLUTTER_DEPRECATED
ClutterTimeline * clutter_animator_get_timeline (ClutterAnimator *animator);
CLUTTER_DEPRECATED
void clutter_animator_set_timeline (ClutterAnimator *animator,
ClutterTimeline *timeline);
CLUTTER_DEPRECATED
guint clutter_animator_get_duration (ClutterAnimator *animator);
CLUTTER_DEPRECATED
void clutter_animator_set_duration (ClutterAnimator *animator,
guint duration);
CLUTTER_DEPRECATED
gboolean clutter_animator_property_get_ease_in (ClutterAnimator *animator,
GObject *object,
const gchar *property_name);
CLUTTER_DEPRECATED
void clutter_animator_property_set_ease_in (ClutterAnimator *animator,
GObject *object,
const gchar *property_name,
gboolean ease_in);
CLUTTER_DEPRECATED
ClutterInterpolation clutter_animator_property_get_interpolation (ClutterAnimator *animator,
GObject *object,
const gchar *property_name);
CLUTTER_DEPRECATED
void clutter_animator_property_set_interpolation (ClutterAnimator *animator,
GObject *object,
const gchar *property_name,
ClutterInterpolation interpolation);
CLUTTER_DEPRECATED
GType clutter_animator_key_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
GObject * clutter_animator_key_get_object (const ClutterAnimatorKey *key);
CLUTTER_DEPRECATED
const gchar * clutter_animator_key_get_property_name (const ClutterAnimatorKey *key);
CLUTTER_DEPRECATED
GType clutter_animator_key_get_property_type (const ClutterAnimatorKey *key);
CLUTTER_DEPRECATED
gulong clutter_animator_key_get_mode (const ClutterAnimatorKey *key);
CLUTTER_DEPRECATED
gdouble clutter_animator_key_get_progress (const ClutterAnimatorKey *key);
CLUTTER_DEPRECATED
gboolean clutter_animator_key_get_value (const ClutterAnimatorKey *key,
GValue *value);
G_END_DECLS
#endif /* __CLUTTER_ANIMATOR_H__ */

View File

@ -48,8 +48,7 @@
* #ClutterBehaviourDepth is available since Clutter 0.4.
*
* Deprecated: 1.6: Use the #ClutterActor:depth property and
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
* instead.
* clutter_actor_animate() instead.
*/
struct _ClutterBehaviourDepthPrivate

View File

@ -32,8 +32,7 @@
* Since: 0.2
*
* Deprecated: 1.6: Use the #ClutterActor:opacity property and
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
* instead.
* clutter_actor_animate().
*/
#include "clutter-build-config.h"

View File

@ -31,8 +31,7 @@
* The #ClutterBehaviourRotate is available since version 0.4.
*
* Deprecated: 1.6: Use the #ClutterActor rotation properties and
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
* instead.
* clutter_actor_animate() instead.
*/
#include "clutter-build-config.h"

View File

@ -31,8 +31,7 @@
* A #ClutterBehaviourScale interpolates actors size between two values.
*
* Deprecated: 1.6: Use the #ClutterActor:scale-x and #ClutterActor:scale-y
* properties, and clutter_actor_animate(), or #ClutterAnimator or
* #ClutterState instead.
* properties, and clutter_actor_animate() instead.
*/
#include "clutter-build-config.h"

View File

@ -25,8 +25,7 @@
* SECTION:clutter-behaviour
* @Title: ClutterBehaviour
* @short_description: Class for providing behaviours to actors
* @Deprecated: 1.6: Use clutter_actor_animate(), #ClutterAnimator or
* #ClutterState instead
* @Deprecated: 1.6: Use clutter_actor_animate() instead
*
* #ClutterBehaviour is the base class for implementing behaviours. A
* behaviour is a controller object for #ClutterActor<!-- -->s; you can

View File

@ -1,745 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2009,2010 Intel Corporation.
*
* 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/>.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
*/
/**
* SECTION:clutter-box
* @short_description: A Generic layout container
*
* #ClutterBox is a #ClutterActor sub-class implementing the #ClutterContainer
* interface. A Box delegates the whole size requisition and size allocation to
* a #ClutterLayoutManager instance.
*
* #ClutterBox is available since Clutter 1.2
*
* #ClutterBox is deprecated since Clutter 1.10; all its relevant API is provided
* by #ClutterActor, via the #ClutterActor:layout-manager property.
*
* ## Using ClutterBox
*
* The following code shows how to create a #ClutterBox with
* a #ClutterLayoutManager sub-class, and how to add children to
* it via clutter_box_pack().
*
* |[<!-- language="C" -->
* ClutterActor *box;
* ClutterLayoutManager *layout;
*
* // Create the layout manager first
* layout = clutter_box_layout_new ();
* clutter_box_layout_set_homogeneous (CLUTTER_BOX_LAYOUT (layout), TRUE);
* clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (layout), 12);
*
* // Then create the ClutterBox actor. The Box will take
* // ownership of the ClutterLayoutManager instance by sinking
* // its floating reference
* box = clutter_box_new (layout);
*
* // Now add children to the Box using the variadic arguments
* // function clutter_box_pack() to set layout properties
* clutter_box_pack (CLUTTER_BOX (box), actor,
* "x-align", CLUTTER_BOX_ALIGNMENT_CENTER,
* "y-align", CLUTTER_BOX_ALIGNMENT_END,
* "expand", TRUE,
* NULL);
* ]|
*
* #ClutterBox's clutter_box_pack() wraps the generic
* clutter_container_add_actor() function, but it also allows setting
* layout properties while adding the new child to the box.
*/
#include "clutter-build-config.h"
#include <glib-object.h>
#include <gobject/gvaluecollector.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-container.h"
#include "clutter-box.h"
#include "clutter-actor-private.h"
#include "clutter-color.h"
#include "clutter-debug.h"
#include "clutter-enum-types.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
struct _ClutterBoxPrivate
{
ClutterLayoutManager *manager;
guint changed_id;
};
enum
{
PROP_0,
PROP_COLOR,
PROP_COLOR_SET,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST] = { NULL, };
static const ClutterColor default_box_color = { 255, 255, 255, 255 };
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBox, clutter_box, CLUTTER_TYPE_ACTOR)
static inline void
clutter_box_set_color_internal (ClutterBox *box,
const ClutterColor *color)
{
clutter_actor_set_background_color (CLUTTER_ACTOR (box), color);
g_object_notify_by_pspec (G_OBJECT (box), obj_props[PROP_COLOR_SET]);
g_object_notify_by_pspec (G_OBJECT (box), obj_props[PROP_COLOR]);
}
static gboolean
clutter_box_real_get_paint_volume (ClutterActor *actor,
ClutterPaintVolume *volume)
{
gboolean retval = FALSE;
ClutterActorIter iter;
ClutterActor *child;
/* if we have a background color, and an allocation, then we need to
* set it as the base of our paint volume
*/
retval = clutter_paint_volume_set_from_allocation (volume, actor);
/* bail out early if we don't have any child */
if (clutter_actor_get_n_children (actor) == 0)
return retval;
retval = TRUE;
/* otherwise, union the paint volumes of our children, in case
* any one of them decides to paint outside the parent's allocation
*/
clutter_actor_iter_init (&iter, actor);
while (clutter_actor_iter_next (&iter, &child))
{
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 retval;
}
static void
clutter_box_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBox *self = CLUTTER_BOX (gobject);
switch (prop_id)
{
case PROP_COLOR:
clutter_box_set_color_internal (self, clutter_value_get_color (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_box_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
case PROP_COLOR:
{
ClutterColor color;
clutter_actor_get_background_color (CLUTTER_ACTOR (gobject),
&color);
clutter_value_set_color (value, &color);
}
break;
case PROP_COLOR_SET:
{
gboolean color_set;
g_object_get (gobject, "background-color-set", &color_set, NULL);
g_value_set_boolean (value, color_set);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_box_real_destroy (ClutterActor *actor)
{
ClutterActor *iter;
iter = clutter_actor_get_first_child (actor);
while (iter != NULL)
{
ClutterActor *next = clutter_actor_get_next_sibling (iter);
clutter_actor_destroy (iter);
iter = next;
}
}
static void
clutter_box_class_init (ClutterBoxClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
actor_class->destroy = clutter_box_real_destroy;
actor_class->get_paint_volume = clutter_box_real_get_paint_volume;
gobject_class->set_property = clutter_box_set_property;
gobject_class->get_property = clutter_box_get_property;
/**
* ClutterBox:color:
*
* The color to be used to paint the background of the
* #ClutterBox. Setting this property will set the
* #ClutterBox:color-set property as a side effect
*
* This property sets the #ClutterActor:background-color property
* internally.
*
* Since: 1.2
*
* Deprecated: 1.10: Use the #ClutterActor:background-color property
*/
obj_props[PROP_COLOR] =
clutter_param_spec_color ("color",
P_("Color"),
P_("The background color of the box"),
&default_box_color,
CLUTTER_PARAM_READWRITE);
/**
* ClutterBox:color-set:
*
* Whether the #ClutterBox:color property has been set.
*
* This property reads the #ClutterActor:background-color-set property
* internally.
*
* Since: 1.2
*
* Deprecated: 1.10: Use the #ClutterActor:background-color-set property
*/
obj_props[PROP_COLOR_SET] =
g_param_spec_boolean ("color-set",
P_("Color Set"),
P_("Whether the background color is set"),
FALSE,
CLUTTER_PARAM_READWRITE);
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
}
static void
clutter_box_init (ClutterBox *self)
{
self->priv = clutter_box_get_instance_private (self);
}
/**
* clutter_box_new:
* @manager: a #ClutterLayoutManager
*
* Creates a new #ClutterBox. The children of the box will be layed
* out by the passed @manager
*
* Return value: the newly created #ClutterBox actor
*
* Since: 1.2
*
* Deprecated: 1.10: Use clutter_actor_new() instead.
*/
ClutterActor *
clutter_box_new (ClutterLayoutManager *manager)
{
g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), NULL);
return g_object_new (CLUTTER_TYPE_BOX,
"layout-manager", manager,
NULL);
}
/**
* clutter_box_set_layout_manager:
* @box: a #ClutterBox
* @manager: a #ClutterLayoutManager
*
* Sets the #ClutterLayoutManager for @box
*
* A #ClutterLayoutManager is a delegate object that controls the
* layout of the children of @box
*
* Since: 1.2
*
* Deprecated: 1.10: Use clutter_actor_set_layout_manager() instead.
*/
void
clutter_box_set_layout_manager (ClutterBox *box,
ClutterLayoutManager *manager)
{
clutter_actor_set_layout_manager (CLUTTER_ACTOR (box), manager);
}
/**
* clutter_box_get_layout_manager:
* @box: a #ClutterBox
*
* Retrieves the #ClutterLayoutManager instance used by @box
*
* Return value: (transfer none): a #ClutterLayoutManager. The returned
* #ClutterLayoutManager is owned by the #ClutterBox and it should not
* be unreferenced
*
* Since: 1.2
*
* Deprecated: 1.10: Use clutter_actor_get_layout_manager() instead.
*/
ClutterLayoutManager *
clutter_box_get_layout_manager (ClutterBox *box)
{
return clutter_actor_get_layout_manager (CLUTTER_ACTOR (box));
}
/**
* clutter_box_packv:
* @box: a #ClutterBox
* @actor: a #ClutterActor
* @n_properties: the number of properties to set
* @properties: (array length=n_properties) (element-type utf8): a vector
* containing the property names to set
* @values: (array length=n_properties): a vector containing the property
* values to set
*
* Vector-based variant of clutter_box_pack(), intended for language
* bindings to use
*
* Since: 1.2
*
* Deprecated: 1.10: Use clutter_actor_add_child() instead. To set
* specific layout properties, use clutter_layout_manager_child_set()
*/
void
clutter_box_packv (ClutterBox *box,
ClutterActor *actor,
guint n_properties,
const gchar * const properties[],
const GValue *values)
{
ClutterLayoutManager *manager;
ClutterContainer *container;
ClutterLayoutMeta *meta;
GObjectClass *klass;
gint i;
g_return_if_fail (CLUTTER_IS_BOX (box));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
container = CLUTTER_CONTAINER (box);
clutter_container_add_actor (container, actor);
manager = clutter_actor_get_layout_manager (CLUTTER_ACTOR (box));
if (manager == NULL)
return;
meta = clutter_layout_manager_get_child_meta (manager,
container,
actor);
if (meta == NULL)
return;
klass = G_OBJECT_GET_CLASS (meta);
for (i = 0; i < n_properties; i++)
{
const gchar *pname = properties[i];
GParamSpec *pspec;
pspec = g_object_class_find_property (klass, pname);
if (pspec == NULL)
{
g_warning ("%s: the layout property '%s' for managers "
"of type '%s' (meta type '%s') does not exist",
G_STRLOC,
pname,
G_OBJECT_TYPE_NAME (manager),
G_OBJECT_TYPE_NAME (meta));
break;
}
if (!(pspec->flags & G_PARAM_WRITABLE))
{
g_warning ("%s: the layout property '%s' for managers "
"of type '%s' (meta type '%s') is not writable",
G_STRLOC,
pspec->name,
G_OBJECT_TYPE_NAME (manager),
G_OBJECT_TYPE_NAME (meta));
break;
}
clutter_layout_manager_child_set_property (manager,
container, actor,
pname, &values[i]);
}
}
static inline void
clutter_box_set_property_valist (ClutterBox *box,
ClutterActor *actor,
const gchar *first_property,
va_list var_args)
{
ClutterContainer *container = CLUTTER_CONTAINER (box);
ClutterLayoutManager *manager;
ClutterLayoutMeta *meta;
GObjectClass *klass;
const gchar *pname;
manager = clutter_actor_get_layout_manager (CLUTTER_ACTOR (box));
if (manager == NULL)
return;
meta = clutter_layout_manager_get_child_meta (manager,
container,
actor);
if (meta == NULL)
return;
klass = G_OBJECT_GET_CLASS (meta);
pname = first_property;
while (pname)
{
GValue value = { 0, };
GParamSpec *pspec;
gchar *error;
pspec = g_object_class_find_property (klass, pname);
if (pspec == NULL)
{
g_warning ("%s: the layout property '%s' for managers "
"of type '%s' (meta type '%s') does not exist",
G_STRLOC,
pname,
G_OBJECT_TYPE_NAME (manager),
G_OBJECT_TYPE_NAME (meta));
break;
}
if (!(pspec->flags & G_PARAM_WRITABLE))
{
g_warning ("%s: the layout property '%s' for managers "
"of type '%s' (meta type '%s') is not writable",
G_STRLOC,
pspec->name,
G_OBJECT_TYPE_NAME (manager),
G_OBJECT_TYPE_NAME (meta));
break;
}
G_VALUE_COLLECT_INIT (&value, G_PARAM_SPEC_VALUE_TYPE (pspec),
var_args, 0,
&error);
if (error)
{
g_warning ("%s: %s", G_STRLOC, error);
g_free (error);
break;
}
clutter_layout_manager_child_set_property (manager,
container, actor,
pspec->name, &value);
g_value_unset (&value);
pname = va_arg (var_args, gchar*);
}
}
/**
* clutter_box_pack:
* @box: a #ClutterBox
* @actor: a #ClutterActor
* @first_property: the name of the first property to set, or %NULL
* @...: a list of property name and value pairs, terminated by %NULL
*
* Adds @actor to @box and sets layout properties at the same time,
* if the #ClutterLayoutManager used by @box has them
*
* This function is a wrapper around clutter_container_add_actor()
* and clutter_layout_manager_child_set()
*
* Language bindings should use the vector-based clutter_box_packv()
* variant instead
*
* Since: 1.2
*
* Deprecated: 1.10: Use clutter_actor_add_child() instead. To set
* specific layout properties, use clutter_layout_manager_child_set()
*/
void
clutter_box_pack (ClutterBox *box,
ClutterActor *actor,
const gchar *first_property,
...)
{
va_list var_args;
g_return_if_fail (CLUTTER_IS_BOX (box));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
clutter_container_add_actor (CLUTTER_CONTAINER (box), actor);
if (first_property == NULL || *first_property == '\0')
return;
va_start (var_args, first_property);
clutter_box_set_property_valist (box, actor, first_property, var_args);
va_end (var_args);
}
/**
* clutter_box_pack_after:
* @box: a #ClutterBox
* @actor: a #ClutterActor
* @sibling: (allow-none): a #ClutterActor or %NULL
* @first_property: the name of the first property to set, or %NULL
* @...: a list of property name and value pairs, terminated by %NULL
*
* Adds @actor to @box, placing it after @sibling, and sets layout
* properties at the same time, if the #ClutterLayoutManager used by
* @box supports them
*
* If @sibling is %NULL then @actor is placed at the end of the
* list of children, to be allocated and painted after every other child
*
* This function is a wrapper around clutter_container_add_actor(),
* clutter_container_raise_child() and clutter_layout_manager_child_set()
*
* Since: 1.2
*
* Deprecated: 1.10: Use clutter_actor_insert_child_above() instead.
* To set specific layout properties, use clutter_layout_manager_child_set()
*/
void
clutter_box_pack_after (ClutterBox *box,
ClutterActor *actor,
ClutterActor *sibling,
const gchar *first_property,
...)
{
va_list var_args;
g_return_if_fail (CLUTTER_IS_BOX (box));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
clutter_container_add_actor (CLUTTER_CONTAINER (box), actor);
clutter_container_raise_child (CLUTTER_CONTAINER (box), actor, sibling);
if (first_property == NULL || *first_property == '\0')
return;
va_start (var_args, first_property);
clutter_box_set_property_valist (box, actor, first_property, var_args);
va_end (var_args);
}
/**
* clutter_box_pack_before:
* @box: a #ClutterBox
* @actor: a #ClutterActor
* @sibling: (allow-none): a #ClutterActor or %NULL
* @first_property: the name of the first property to set, or %NULL
* @...: a list of property name and value pairs, terminated by %NULL
*
* Adds @actor to @box, placing it before @sibling, and sets layout
* properties at the same time, if the #ClutterLayoutManager used by
* @box supports them
*
* If @sibling is %NULL then @actor is placed at the beginning of the
* list of children, to be allocated and painted below every other child
*
* This function is a wrapper around clutter_container_add_actor(),
* clutter_container_lower_child() and clutter_layout_manager_child_set()
*
* Since: 1.2
*
* Deprecated: 1.10: Use clutter_actor_insert_child_below() instead.
* To set specific layout properties, use clutter_layout_manager_child_set()
*/
void
clutter_box_pack_before (ClutterBox *box,
ClutterActor *actor,
ClutterActor *sibling,
const gchar *first_property,
...)
{
va_list var_args;
g_return_if_fail (CLUTTER_IS_BOX (box));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
clutter_container_add_actor (CLUTTER_CONTAINER (box), actor);
clutter_container_lower_child (CLUTTER_CONTAINER (box), actor, sibling);
if (first_property == NULL || *first_property == '\0')
return;
va_start (var_args, first_property);
clutter_box_set_property_valist (box, actor, first_property, var_args);
va_end (var_args);
}
/**
* clutter_box_pack_at:
* @box: a #ClutterBox
* @actor: a #ClutterActor
* @position: the position to insert the @actor at
* @first_property: the name of the first property to set, or %NULL
* @...: a list of property name and value pairs, terminated by %NULL
*
* Adds @actor to @box, placing it at @position, and sets layout
* properties at the same time, if the #ClutterLayoutManager used by
* @box supports them
*
* If @position is a negative number, or is larger than the number of
* children of @box, the new child is added at the end of the list of
* children
*
* Since: 1.2
*
* Deprecated: 1.10: Use clutter_actor_insert_child_at_index() instead.
* To set specific layout properties, use clutter_layout_manager_child_set()
*/
void
clutter_box_pack_at (ClutterBox *box,
ClutterActor *actor,
gint position,
const gchar *first_property,
...)
{
va_list var_args;
g_return_if_fail (CLUTTER_IS_BOX (box));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
clutter_actor_insert_child_at_index (CLUTTER_ACTOR (box),
actor,
position);
/* we need to explicitly call this, because we're not going through
* the default code paths provided by clutter_container_add()
*/
clutter_container_create_child_meta (CLUTTER_CONTAINER (box), actor);
g_signal_emit_by_name (box, "actor-added", actor);
if (first_property == NULL || *first_property == '\0')
return;
va_start (var_args, first_property);
clutter_box_set_property_valist (box, actor, first_property, var_args);
va_end (var_args);
}
/**
* clutter_box_set_color:
* @box: a #ClutterBox
* @color: (allow-none): the background color, or %NULL to unset
*
* Sets (or unsets) the background color for @box
*
* Since: 1.2
*
* Deprecated: 1.10: Use clutter_actor_set_background_color() instead.
*/
void
clutter_box_set_color (ClutterBox *box,
const ClutterColor *color)
{
g_return_if_fail (CLUTTER_IS_BOX (box));
clutter_box_set_color_internal (box, color);
}
/**
* clutter_box_get_color:
* @box: a #ClutterBox
* @color: (out caller-allocates): return location for a #ClutterColor
*
* Retrieves the background color of @box
*
* If the #ClutterBox:color-set property is set to %FALSE the
* returned #ClutterColor is undefined
*
* Since: 1.2
*
* Deprecated: 1.10: Use clutter_actor_get_background_color() instead.
*/
void
clutter_box_get_color (ClutterBox *box,
ClutterColor *color)
{
g_return_if_fail (CLUTTER_IS_BOX (box));
g_return_if_fail (color != NULL);
clutter_actor_get_background_color (CLUTTER_ACTOR (box), color);
}

View File

@ -1,143 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2009,2010 Intel Corporation.
*
* 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/>.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BOX_H__
#define __CLUTTER_BOX_H__
#include <clutter/clutter-actor.h>
#include <clutter/clutter-container.h>
#include <clutter/clutter-layout-manager.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BOX (clutter_box_get_type ())
#define CLUTTER_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BOX, ClutterBox))
#define CLUTTER_IS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BOX))
#define CLUTTER_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BOX, ClutterBoxClass))
#define CLUTTER_IS_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BOX))
#define CLUTTER_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BOX, ClutterBoxClass))
typedef struct _ClutterBox ClutterBox;
typedef struct _ClutterBoxPrivate ClutterBoxPrivate;
typedef struct _ClutterBoxClass ClutterBoxClass;
/**
* ClutterBox:
*
* The #ClutterBox structure contains only private data and should
* be accessed using the provided API
*
* Since: 1.2
*/
struct _ClutterBox
{
/*< private >*/
ClutterActor parent_instance;
ClutterBoxPrivate *priv;
};
/**
* ClutterBoxClass:
*
* The #ClutterBoxClass structure contains only private data
*
* Since: 1.2
*/
struct _ClutterBoxClass
{
/*< private >*/
ClutterActorClass parent_class;
/* padding, for future expansion */
void (*clutter_padding_1) (void);
void (*clutter_padding_2) (void);
void (*clutter_padding_3) (void);
void (*clutter_padding_4) (void);
void (*clutter_padding_5) (void);
void (*clutter_padding_6) (void);
};
CLUTTER_DEPRECATED
GType clutter_box_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_FOR(clutter_actor_new)
ClutterActor * clutter_box_new (ClutterLayoutManager *manager);
CLUTTER_DEPRECATED_FOR(clutter_actor_set_layout_manager)
void clutter_box_set_layout_manager (ClutterBox *box,
ClutterLayoutManager *manager);
CLUTTER_DEPRECATED_FOR(clutter_actor_get_layout_manager)
ClutterLayoutManager *clutter_box_get_layout_manager (ClutterBox *box);
CLUTTER_DEPRECATED_FOR(clutter_actor_set_background_color)
void clutter_box_set_color (ClutterBox *box,
const ClutterColor *color);
CLUTTER_DEPRECATED_FOR(clutter_actor_get_background_color)
void clutter_box_get_color (ClutterBox *box,
ClutterColor *color);
CLUTTER_DEPRECATED_FOR(clutter_actor_add_child)
void clutter_box_pack (ClutterBox *box,
ClutterActor *actor,
const gchar *first_property,
...);
CLUTTER_DEPRECATED_FOR(clutter_actor_add_child)
void clutter_box_packv (ClutterBox *box,
ClutterActor *actor,
guint n_properties,
const gchar * const properties[],
const GValue *values);
CLUTTER_DEPRECATED_FOR(clutter_actor_insert_child_above)
void clutter_box_pack_after (ClutterBox *box,
ClutterActor *actor,
ClutterActor *sibling,
const gchar *first_property,
...);
CLUTTER_DEPRECATED_FOR(clutter_actor_insert_child_below)
void clutter_box_pack_before (ClutterBox *box,
ClutterActor *actor,
ClutterActor *sibling,
const gchar *first_property,
...);
CLUTTER_DEPRECATED_FOR(clutter_actor_insert_child_at_index)
void clutter_box_pack_at (ClutterBox *box,
ClutterActor *actor,
gint position,
const gchar *first_property,
...);
G_END_DECLS
#endif /* __CLUTTER_BOX_H__ */

View File

@ -1,261 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Neil Roberts <neil@linux.intel.com>
*
* Copyright (C) 2008 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/>.
*
*
*/
#include "clutter-build-config.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-main.h"
#include "clutter-private.h"
#include "deprecated/clutter-frame-source.h"
#include "deprecated/clutter-timeout-interval.h"
typedef struct _ClutterFrameSource ClutterFrameSource;
struct _ClutterFrameSource
{
GSource source;
ClutterTimeoutInterval timeout;
};
static gboolean clutter_frame_source_prepare (GSource *source,
gint *timeout);
static gboolean clutter_frame_source_check (GSource *source);
static gboolean clutter_frame_source_dispatch (GSource *source,
GSourceFunc callback,
gpointer user_data);
static GSourceFuncs clutter_frame_source_funcs =
{
clutter_frame_source_prepare,
clutter_frame_source_check,
clutter_frame_source_dispatch,
NULL
};
/**
* clutter_frame_source_add_full: (rename-to clutter_frame_source_add)
* @priority: the priority of the frame source. Typically this will be in the
* range between %G_PRIORITY_DEFAULT and %G_PRIORITY_HIGH.
* @fps: the number of times per second to call the function
* @func: function to call
* @data: data to pass to the function
* @notify: function to call when the timeout source is removed
*
* Sets a function to be called at regular intervals with the given
* priority. The function is called repeatedly until it returns
* %FALSE, at which point the timeout is automatically destroyed and
* the function will not be called again. The @notify function is
* called when the timeout is destroyed. The first call to the
* function will be at the end of the first @interval.
*
* This function is similar to g_timeout_add_full() except that it
* will try to compensate for delays. For example, if @func takes half
* the interval time to execute then the function will be called again
* half the interval time after it finished. In contrast
* g_timeout_add_full() would not fire until a full interval after the
* function completes so the delay between calls would be 1.0 / @fps *
* 1.5. This function does not however try to invoke the function
* multiple times to catch up missing frames if @func takes more than
* @interval ms to execute.
*
* Return value: the ID (greater than 0) of the event source.
*
* Since: 0.8
*
* Deprecated: 1.6: There is no direct replacement for this API.
*/
guint
clutter_frame_source_add_full (gint priority,
guint fps,
GSourceFunc func,
gpointer data,
GDestroyNotify notify)
{
guint ret;
GSource *source = g_source_new (&clutter_frame_source_funcs,
sizeof (ClutterFrameSource));
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
_clutter_timeout_interval_init (&frame_source->timeout, fps);
if (priority != G_PRIORITY_DEFAULT)
g_source_set_priority (source, priority);
g_source_set_name (source, "Clutter frame timeout");
g_source_set_callback (source, func, data, notify);
ret = g_source_attach (source, NULL);
g_source_unref (source);
return ret;
}
/**
* clutter_frame_source_add: (skip)
* @fps: the number of times per second to call the function
* @func: function to call
* @data: data to pass to the function
*
* Simple wrapper around clutter_frame_source_add_full().
*
* Return value: the ID (greater than 0) of the event source.
*
* Since: 0.8
*
* Deprecated: 1.6: There is no direct replacement for this API
*/
guint
clutter_frame_source_add (guint fps,
GSourceFunc func,
gpointer data)
{
return clutter_frame_source_add_full (G_PRIORITY_DEFAULT,
fps, func, data, NULL);
}
static gboolean
clutter_frame_source_prepare (GSource *source,
gint *delay)
{
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
gint64 current_time;
#if GLIB_CHECK_VERSION (2, 27, 3)
current_time = g_source_get_time (source) / 1000;
#else
{
GTimeVal source_time;
g_source_get_current_time (source, &source_time);
current_time = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
}
#endif
return _clutter_timeout_interval_prepare (current_time,
&frame_source->timeout,
delay);
}
static gboolean
clutter_frame_source_check (GSource *source)
{
return clutter_frame_source_prepare (source, NULL);
}
static gboolean
clutter_frame_source_dispatch (GSource *source,
GSourceFunc callback,
gpointer user_data)
{
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
return _clutter_timeout_interval_dispatch (&frame_source->timeout,
callback, user_data);
}
/**
* clutter_threads_add_frame_source_full: (rename-to clutter_threads_add_frame_source)
* @priority: the priority of the frame source. Typically this will be in the
* range between %G_PRIORITY_DEFAULT and %G_PRIORITY_HIGH.
* @fps: the number of times per second to call the function
* @func: function to call
* @data: data to pass to the function
* @notify: function to call when the timeout source is removed
*
* Sets a function to be called at regular intervals holding the Clutter
* threads lock, with the given priority. The function is called repeatedly
* until it returns %FALSE, at which point the timeout is automatically
* removed and the function will not be called again. The @notify function
* is called when the timeout is removed.
*
* This function is similar to clutter_threads_add_timeout_full()
* except that it will try to compensate for delays. For example, if
* @func takes half the interval time to execute then the function
* will be called again half the interval time after it finished. In
* contrast clutter_threads_add_timeout_full() would not fire until a
* full interval after the function completes so the delay between
* calls would be @interval * 1.5. This function does not however try
* to invoke the function multiple times to catch up missing frames if
* @func takes more than @interval ms to execute.
*
* See also clutter_threads_add_idle_full().
*
* Return value: the ID (greater than 0) of the event source.
*
* Since: 0.8
*
* Deprecated: 1.6: There is no direct replacement for this API
*/
guint
clutter_threads_add_frame_source_full (gint priority,
guint fps,
GSourceFunc func,
gpointer data,
GDestroyNotify notify)
{
ClutterThreadsDispatch *dispatch;
g_return_val_if_fail (func != NULL, 0);
dispatch = g_slice_new (ClutterThreadsDispatch);
dispatch->func = func;
dispatch->data = data;
dispatch->notify = notify;
return clutter_frame_source_add_full (priority,
fps,
_clutter_threads_dispatch, dispatch,
_clutter_threads_dispatch_free);
}
/**
* clutter_threads_add_frame_source: (skip)
* @fps: the number of times per second to call the function
* @func: function to call
* @data: data to pass to the function
*
* Simple wrapper around clutter_threads_add_frame_source_full().
*
* Return value: the ID (greater than 0) of the event source.
*
* Since: 0.8
*
* Deprecated: 1.6: There is no direct replacement for this API
*/
guint
clutter_threads_add_frame_source (guint fps,
GSourceFunc func,
gpointer data)
{
g_return_val_if_fail (func != NULL, 0);
return clutter_threads_add_frame_source_full (G_PRIORITY_DEFAULT,
fps,
func, data,
NULL);
}

View File

@ -1,49 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2008 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_FRAME_SOURCE_H__
#define __CLUTTER_FRAME_SOURCE_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED
guint clutter_frame_source_add (guint fps,
GSourceFunc func,
gpointer data);
CLUTTER_DEPRECATED
guint clutter_frame_source_add_full (gint priority,
guint fps,
GSourceFunc func,
gpointer data,
GDestroyNotify notify);
G_END_DECLS
#endif /* __CLUTTER_FRAME_SOURCE_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

@ -1,834 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Neil Jagdish Patel <njp@o-hand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
/**
* SECTION:clutter-list-model
* @short_description: List model implementation
*
* #ClutterListModel is a #ClutterModel implementation provided by
* Clutter. #ClutterListModel uses a #GSequence for storing the
* values for each row, so it's optimized for insertion and look up
* in sorted lists.
*
* #ClutterListModel is available since Clutter 0.6
*
* Deprecated: 1.24: Use a #GListStore instance containing a custom
* object type with properties for each column instead.
*/
#include "clutter-build-config.h"
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-list-model.h"
#include "clutter-model.h"
#include "clutter-model-private.h"
#include "clutter-private.h"
#include "clutter-debug.h"
#define CLUTTER_TYPE_LIST_MODEL_ITER \
(clutter_list_model_iter_get_type())
#define CLUTTER_LIST_MODEL_ITER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
CLUTTER_TYPE_LIST_MODEL_ITER, \
ClutterListModelIter))
#define CLUTTER_IS_LIST_MODEL_ITER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), \
CLUTTER_TYPE_LIST_MODEL_ITER))
#define CLUTTER_LIST_MODEL_ITER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_LIST_MODEL_ITER, \
ClutterListModelIterClass))
#define CLUTTER_IS_LIST_MODEL_ITER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_LIST_MODEL_ITER))
#define CLUTTER_LIST_MODEL_ITER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_LIST_MODEL_ITER, \
ClutterListModelIterClass))
typedef struct _ClutterListModelIter ClutterListModelIter;
typedef struct _ClutterModelIterClass ClutterListModelIterClass;
struct _ClutterListModelPrivate
{
GSequence *sequence;
ClutterModelIter *temp_iter;
};
struct _ClutterListModelIter
{
ClutterModelIter parent_instance;
GSequenceIter *seq_iter;
};
GType clutter_list_model_iter_get_type (void);
/*
* ClutterListModel
*/
G_DEFINE_TYPE (ClutterListModelIter,
clutter_list_model_iter,
CLUTTER_TYPE_MODEL_ITER)
static void
clutter_list_model_iter_get_value (ClutterModelIter *iter,
guint column,
GValue *value)
{
ClutterListModelIter *iter_default;
GValue *values;
GValue *iter_value;
GValue real_value = G_VALUE_INIT;
gboolean converted = FALSE;
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
g_assert (iter_default->seq_iter != NULL);
values = g_sequence_get (iter_default->seq_iter);
iter_value = &values[column];
g_assert (iter_value != NULL);
if (!g_type_is_a (G_VALUE_TYPE (value), G_VALUE_TYPE (iter_value)))
{
if (!g_value_type_compatible (G_VALUE_TYPE (value),
G_VALUE_TYPE (iter_value)) &&
!g_value_type_compatible (G_VALUE_TYPE (iter_value),
G_VALUE_TYPE (value)))
{
g_warning ("%s: Unable to convert from %s to %s",
G_STRLOC,
g_type_name (G_VALUE_TYPE (value)),
g_type_name (G_VALUE_TYPE (iter_value)));
return;
}
if (!g_value_transform (iter_value, &real_value))
{
g_warning ("%s: Unable to make conversion from %s to %s",
G_STRLOC,
g_type_name (G_VALUE_TYPE (value)),
g_type_name (G_VALUE_TYPE (iter_value)));
g_value_unset (&real_value);
}
converted = TRUE;
}
if (converted)
{
g_value_copy (&real_value, value);
g_value_unset (&real_value);
}
else
g_value_copy (iter_value, value);
}
static void
clutter_list_model_iter_set_value (ClutterModelIter *iter,
guint column,
const GValue *value)
{
ClutterListModelIter *iter_default;
GValue *values;
GValue *iter_value;
GValue real_value = G_VALUE_INIT;
gboolean converted = FALSE;
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
g_assert (iter_default->seq_iter != NULL);
values = g_sequence_get (iter_default->seq_iter);
iter_value = &values[column];
g_assert (iter_value != NULL);
if (!g_type_is_a (G_VALUE_TYPE (value), G_VALUE_TYPE (iter_value)))
{
if (!g_value_type_compatible (G_VALUE_TYPE (value),
G_VALUE_TYPE (iter_value)) &&
!g_value_type_compatible (G_VALUE_TYPE (iter_value),
G_VALUE_TYPE (value)))
{
g_warning ("%s: Unable to convert from %s to %s\n",
G_STRLOC,
g_type_name (G_VALUE_TYPE (value)),
g_type_name (G_VALUE_TYPE (iter_value)));
return;
}
if (!g_value_transform (value, &real_value))
{
g_warning ("%s: Unable to make conversion from %s to %s\n",
G_STRLOC,
g_type_name (G_VALUE_TYPE (value)),
g_type_name (G_VALUE_TYPE (iter_value)));
g_value_unset (&real_value);
}
converted = TRUE;
}
if (converted)
{
g_value_copy (&real_value, iter_value);
g_value_unset (&real_value);
}
else
g_value_copy (value, iter_value);
}
static gboolean
clutter_list_model_iter_is_first (ClutterModelIter *iter)
{
ClutterListModelIter *iter_default;
ClutterModel *model;
ClutterModelIter *temp_iter;
GSequence *sequence;
GSequenceIter *begin, *end;
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
g_assert (iter_default->seq_iter != NULL);
model = clutter_model_iter_get_model (iter);
sequence = CLUTTER_LIST_MODEL (model)->priv->sequence;
begin = g_sequence_get_begin_iter (sequence);
end = iter_default->seq_iter;
temp_iter = CLUTTER_LIST_MODEL (model)->priv->temp_iter;
while (!g_sequence_iter_is_begin (begin))
{
CLUTTER_LIST_MODEL_ITER (temp_iter)->seq_iter = begin;
if (clutter_model_filter_iter (model, temp_iter))
{
end = begin;
break;
}
begin = g_sequence_iter_next (begin);
}
/* This is because the 'begin_iter' is always *before* the last valid
* iter, otherwise we'd have endless loops
*/
end = g_sequence_iter_prev (end);
return iter_default->seq_iter == end;
}
static gboolean
clutter_list_model_iter_is_last (ClutterModelIter *iter)
{
ClutterListModelIter *iter_default;
ClutterModelIter *temp_iter;
ClutterModel *model;
GSequence *sequence;
GSequenceIter *begin, *end;
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
g_assert (iter_default->seq_iter != NULL);
if (g_sequence_iter_is_end (iter_default->seq_iter))
return TRUE;
model = clutter_model_iter_get_model (iter);
sequence = CLUTTER_LIST_MODEL (model)->priv->sequence;
begin = g_sequence_get_end_iter (sequence);
begin = g_sequence_iter_prev (begin);
end = iter_default->seq_iter;
temp_iter = CLUTTER_LIST_MODEL (model)->priv->temp_iter;
while (!g_sequence_iter_is_begin (begin))
{
CLUTTER_LIST_MODEL_ITER (temp_iter)->seq_iter = begin;
if (clutter_model_filter_iter (model, temp_iter))
{
end = begin;
break;
}
begin = g_sequence_iter_prev (begin);
}
/* This is because the 'end_iter' is always *after* the last valid iter.
* Otherwise we'd have endless loops
*/
end = g_sequence_iter_next (end);
return iter_default->seq_iter == end;
}
static ClutterModelIter *
clutter_list_model_iter_next (ClutterModelIter *iter)
{
ClutterListModelIter *iter_default;
ClutterModelIter *temp_iter;
ClutterModel *model = NULL;
GSequenceIter *filter_next;
guint row;
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
g_assert (iter_default->seq_iter != NULL);
model = clutter_model_iter_get_model (iter);
row = clutter_model_iter_get_row (iter);
filter_next = g_sequence_iter_next (iter_default->seq_iter);
g_assert (filter_next != NULL);
temp_iter = CLUTTER_LIST_MODEL (model)->priv->temp_iter;
while (!g_sequence_iter_is_end (filter_next))
{
CLUTTER_LIST_MODEL_ITER (temp_iter)->seq_iter = filter_next;
if (clutter_model_filter_iter (model, temp_iter))
{
row += 1;
break;
}
filter_next = g_sequence_iter_next (filter_next);
}
if (g_sequence_iter_is_end (filter_next))
row += 1;
/* update the iterator and return it */
_clutter_model_iter_set_row (CLUTTER_MODEL_ITER (iter_default), row);
iter_default->seq_iter = filter_next;
return CLUTTER_MODEL_ITER (iter_default);
}
static ClutterModelIter *
clutter_list_model_iter_prev (ClutterModelIter *iter)
{
ClutterListModelIter *iter_default;
ClutterModelIter *temp_iter;
ClutterModel *model;
GSequenceIter *filter_prev;
guint row;
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
g_assert (iter_default->seq_iter != NULL);
model = clutter_model_iter_get_model (iter);
row = clutter_model_iter_get_row (iter);
filter_prev = g_sequence_iter_prev (iter_default->seq_iter);
g_assert (filter_prev != NULL);
temp_iter = CLUTTER_LIST_MODEL (model)->priv->temp_iter;
while (!g_sequence_iter_is_begin (filter_prev))
{
CLUTTER_LIST_MODEL_ITER (temp_iter)->seq_iter = filter_prev;
if (clutter_model_filter_iter (model, temp_iter))
{
row -= 1;
break;
}
filter_prev = g_sequence_iter_prev (filter_prev);
}
if (g_sequence_iter_is_begin (filter_prev))
row -= 1;
/* update the iterator and return it */
_clutter_model_iter_set_row (CLUTTER_MODEL_ITER (iter_default), row);
iter_default->seq_iter = filter_prev;
return CLUTTER_MODEL_ITER (iter_default);
}
static ClutterModelIter *
clutter_list_model_iter_copy (ClutterModelIter *iter)
{
ClutterListModelIter *iter_default;
ClutterListModelIter *iter_copy;
ClutterModel *model;
guint row;
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
model = clutter_model_iter_get_model (iter);
row = clutter_model_iter_get_row (iter) - 1;
iter_copy = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
"model", model,
"row", row,
NULL);
/* this is safe, because the seq_iter pointer on the passed
* iterator will be always be overwritten in ::next or ::prev
*/
iter_copy->seq_iter = iter_default->seq_iter;
return CLUTTER_MODEL_ITER (iter_copy);
}
static void
clutter_list_model_iter_class_init (ClutterListModelIterClass *klass)
{
ClutterModelIterClass *iter_class = CLUTTER_MODEL_ITER_CLASS (klass);
iter_class->get_value = clutter_list_model_iter_get_value;
iter_class->set_value = clutter_list_model_iter_set_value;
iter_class->is_first = clutter_list_model_iter_is_first;
iter_class->is_last = clutter_list_model_iter_is_last;
iter_class->next = clutter_list_model_iter_next;
iter_class->prev = clutter_list_model_iter_prev;
iter_class->copy = clutter_list_model_iter_copy;
}
static void
clutter_list_model_iter_init (ClutterListModelIter *iter)
{
iter->seq_iter = NULL;
}
/*
* ClutterListModel
*/
G_DEFINE_TYPE_WITH_PRIVATE (ClutterListModel, clutter_list_model, CLUTTER_TYPE_MODEL)
static ClutterModelIter *
clutter_list_model_get_iter_at_row (ClutterModel *model,
guint row)
{
ClutterListModel *model_default = CLUTTER_LIST_MODEL (model);
GSequence *sequence = model_default->priv->sequence;
GSequenceIter *filter_next;
gint seq_length = g_sequence_get_length (sequence);
ClutterListModelIter *retval;
gint count = -1;
if (row >= seq_length)
return NULL;
retval = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
"model", model,
"row", row,
NULL);
/* short-circuit in case we don't have a filter in place */
if (!clutter_model_get_filter_set (model))
{
retval->seq_iter = g_sequence_get_iter_at_pos (sequence, row);
return CLUTTER_MODEL_ITER (retval);
}
filter_next = g_sequence_get_begin_iter (sequence);
g_assert (filter_next != NULL);
while (!g_sequence_iter_is_end (filter_next))
{
retval->seq_iter = filter_next;
if (clutter_model_filter_iter (model, CLUTTER_MODEL_ITER (retval)))
{
/* We've found a row that is valid under the filter */
count++;
if (count == row)
break;
}
filter_next = g_sequence_iter_next (filter_next);
}
if (count != row)
{
g_object_unref (retval);
return NULL;
}
return CLUTTER_MODEL_ITER (retval);
}
static ClutterModelIter *
clutter_list_model_insert_row (ClutterModel *model,
gint index_)
{
ClutterListModel *model_default = CLUTTER_LIST_MODEL (model);
GSequence *sequence = model_default->priv->sequence;
ClutterListModelIter *retval;
guint n_columns, i, pos;
GValue *values;
GSequenceIter *seq_iter;
n_columns = clutter_model_get_n_columns (model);
values = g_new0 (GValue, n_columns);
for (i = 0; i < n_columns; i++)
g_value_init (&values[i], clutter_model_get_column_type (model, i));
if (index_ < 0)
{
seq_iter = g_sequence_append (sequence, values);
pos = g_sequence_get_length (sequence) - 1;
}
else if (index_ == 0)
{
seq_iter = g_sequence_prepend (sequence, values);
pos = 0;
}
else
{
seq_iter = g_sequence_get_iter_at_pos (sequence, index_);
seq_iter = g_sequence_insert_before (seq_iter, values);
pos = index_;
}
retval = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
"model", model,
"row", pos,
NULL);
retval->seq_iter = seq_iter;
return CLUTTER_MODEL_ITER (retval);
}
static void
clutter_list_model_remove_row (ClutterModel *model,
guint row)
{
ClutterListModel *model_default = CLUTTER_LIST_MODEL (model);
GSequence *sequence = model_default->priv->sequence;
GSequenceIter *seq_iter;
guint pos = 0;
seq_iter = g_sequence_get_begin_iter (sequence);
while (!g_sequence_iter_is_end (seq_iter))
{
if (clutter_model_filter_row (model, pos))
{
if (pos == row)
{
ClutterModelIter *iter;
iter = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
"model", model,
"row", pos,
NULL);
CLUTTER_LIST_MODEL_ITER (iter)->seq_iter = seq_iter;
/* the actual row is removed from the sequence inside
* the ::row-removed signal class handler, so that every
* handler connected to ::row-removed will still get
* a valid iterator, and every signal connected to
* ::row-removed with the AFTER flag will get an updated
* model
*/
g_signal_emit_by_name (model, "row-removed", iter);
g_object_unref (iter);
break;
}
}
pos += 1;
seq_iter = g_sequence_iter_next (seq_iter);
}
}
typedef struct
{
ClutterModel *model;
guint column;
ClutterModelSortFunc func;
gpointer data;
} SortClosure;
static gint
sort_model_default (gconstpointer a,
gconstpointer b,
gpointer data)
{
const GValue *row_a = a;
const GValue *row_b = b;
SortClosure *clos = data;
return clos->func (clos->model,
&row_a[clos->column],
&row_b[clos->column],
clos->data);
}
static void
clutter_list_model_resort (ClutterModel *model,
ClutterModelSortFunc func,
gpointer data)
{
SortClosure sort_closure = { NULL, 0, NULL, NULL };
sort_closure.model = model;
sort_closure.column = clutter_model_get_sorting_column (model);
sort_closure.func = func;
sort_closure.data = data;
g_sequence_sort (CLUTTER_LIST_MODEL (model)->priv->sequence,
sort_model_default,
&sort_closure);
}
static guint
clutter_list_model_get_n_rows (ClutterModel *model)
{
ClutterListModel *list_model = CLUTTER_LIST_MODEL (model);
/* short-circuit in case we don't have a filter in place */
if (!clutter_model_get_filter_set (model))
return g_sequence_get_length (list_model->priv->sequence);
return CLUTTER_MODEL_CLASS (clutter_list_model_parent_class)->get_n_rows (model);
}
static void
clutter_list_model_row_removed (ClutterModel *model,
ClutterModelIter *iter)
{
ClutterListModelIter *iter_default;
guint i, n_columns;
GValue *values;
n_columns = clutter_model_get_n_columns (model);
iter_default = CLUTTER_LIST_MODEL_ITER (iter);
values = g_sequence_get (iter_default->seq_iter);
for (i = 0; i < n_columns; i++)
g_value_unset (&values[i]);
g_free (values);
g_sequence_remove (iter_default->seq_iter);
iter_default->seq_iter = NULL;
}
static void
clutter_list_model_finalize (GObject *gobject)
{
ClutterListModel *model = CLUTTER_LIST_MODEL (gobject);
GSequence *sequence = model->priv->sequence;
GSequenceIter *iter;
guint n_columns, i;
n_columns = clutter_model_get_n_columns (CLUTTER_MODEL (gobject));
iter = g_sequence_get_begin_iter (sequence);
while (!g_sequence_iter_is_end (iter))
{
GValue *values = g_sequence_get (iter);
for (i = 0; i < n_columns; i++)
g_value_unset (&values[i]);
g_free (values);
iter = g_sequence_iter_next (iter);
}
g_sequence_free (sequence);
G_OBJECT_CLASS (clutter_list_model_parent_class)->finalize (gobject);
}
static void
clutter_list_model_dispose (GObject *gobject)
{
ClutterListModel *model = CLUTTER_LIST_MODEL (gobject);
if (model->priv->temp_iter)
{
g_object_unref (model->priv->temp_iter);
model->priv->temp_iter = NULL;
}
G_OBJECT_CLASS (clutter_list_model_parent_class)->dispose (gobject);
}
static void
clutter_list_model_class_init (ClutterListModelClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterModelClass *model_class = CLUTTER_MODEL_CLASS (klass);
gobject_class->finalize = clutter_list_model_finalize;
gobject_class->dispose = clutter_list_model_dispose;
model_class->get_iter_at_row = clutter_list_model_get_iter_at_row;
model_class->insert_row = clutter_list_model_insert_row;
model_class->remove_row = clutter_list_model_remove_row;
model_class->resort = clutter_list_model_resort;
model_class->get_n_rows = clutter_list_model_get_n_rows;
model_class->row_removed = clutter_list_model_row_removed;
}
static void
clutter_list_model_init (ClutterListModel *model)
{
model->priv = clutter_list_model_get_instance_private (model);
model->priv->sequence = g_sequence_new (NULL);
model->priv->temp_iter = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
"model",
model,
NULL);
}
/**
* clutter_list_model_new:
* @n_columns: number of columns in the model
* @...: @n_columns number of #GType and string pairs
*
* Creates a new default model with @n_columns columns with the types
* and names passed in.
*
* For example:
*
* <informalexample><programlisting>
* model = clutter_list_model_new (3,
* G_TYPE_INT, "Score",
* G_TYPE_STRING, "Team",
* GDK_TYPE_PIXBUF, "Logo");
* </programlisting></informalexample>
*
* will create a new #ClutterModel with three columns of type int,
* string and #GdkPixbuf respectively.
*
* Note that the name of the column can be set to %NULL, in which case
* the canonical name of the type held by the column will be used as
* the title.
*
* Return value: a new #ClutterListModel
*
* Since: 0.6
*
* Deprecated: 1.24: Use #GListStore instead
*/
ClutterModel *
clutter_list_model_new (guint n_columns,
...)
{
ClutterModel *model;
va_list args;
gint i;
g_return_val_if_fail (n_columns > 0, NULL);
model = g_object_new (CLUTTER_TYPE_LIST_MODEL, NULL);
_clutter_model_set_n_columns (model, n_columns, TRUE, TRUE);
va_start (args, n_columns);
for (i = 0; i < n_columns; i++)
{
GType type = va_arg (args, GType);
const gchar *name = va_arg (args, gchar*);
if (!_clutter_model_check_type (type))
{
g_warning ("%s: Invalid type %s\n", G_STRLOC, g_type_name (type));
g_object_unref (model);
model = NULL;
goto out;
}
_clutter_model_set_column_type (model, i, type);
_clutter_model_set_column_name (model, i, name);
}
out:
va_end (args);
return model;
}
/**
* clutter_list_model_newv:
* @n_columns: number of columns in the model
* @types: (array length=n_columns): an array of #GType types for the columns, from first to last
* @names: (array length=n_columns): an array of names for the columns, from first to last
*
* Non-vararg version of clutter_list_model_new(). This function is
* useful for language bindings.
*
* Return value: (transfer full): a new default #ClutterModel
*
* Since: 0.6
*
* Deprecated: 1.24: Use #GListStore instead
*/
ClutterModel *
clutter_list_model_newv (guint n_columns,
GType *types,
const gchar * const names[])
{
ClutterModel *model;
gint i;
g_return_val_if_fail (n_columns > 0, NULL);
model = g_object_new (CLUTTER_TYPE_LIST_MODEL, NULL);
_clutter_model_set_n_columns (model, n_columns, TRUE, TRUE);
for (i = 0; i < n_columns; i++)
{
if (!_clutter_model_check_type (types[i]))
{
g_warning ("%s: Invalid type %s\n", G_STRLOC, g_type_name (types[i]));
g_object_unref (model);
return NULL;
}
_clutter_model_set_column_type (model, i, types[i]);
_clutter_model_set_column_name (model, i, names[i]);
}
return model;
}

View File

@ -1,95 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Neil Jagdish Patel <njp@o-hand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* NB: Inspiration for column storage taken from GtkListStore
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_LIST_MODEL_H__
#define __CLUTTER_LIST_MODEL_H__
#include <clutter/deprecated/clutter-model.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_LIST_MODEL (clutter_list_model_get_type ())
#define CLUTTER_LIST_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LIST_MODEL, ClutterListModel))
#define CLUTTER_IS_LIST_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LIST_MODEL))
#define CLUTTER_LIST_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_LIST_MODEL, ClutterListModeClass))
#define CLUTTER_IS_LIST_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_LIST_MODEL))
#define CLUTTER_LIST_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_LIST_MODEL, ClutterListModeClass))
typedef struct _ClutterListModel ClutterListModel;
typedef struct _ClutterListModelPrivate ClutterListModelPrivate;
typedef struct _ClutterListModelClass ClutterListModelClass;
/**
* ClutterListModel:
*
* The #ClutterListModel struct contains only private data.
*
* Since: 0.6
*
* Deprecated: 1.24: Use #GListStore instead
*/
struct _ClutterListModel
{
/*< private >*/
ClutterModel parent_instance;
ClutterListModelPrivate *priv;
};
/**
* ClutterListModelClass:
*
* The #ClutterListModelClass struct contains only private data.
*
* Since: 0.6
*
* Deprecated: 1.24: Use #GListStore instead
*/
struct _ClutterListModelClass
{
/*< private >*/
ClutterModelClass parent_class;
};
CLUTTER_DEPRECATED_FOR(g_list_store_get_type)
GType clutter_list_model_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_FOR(g_list_store_new)
ClutterModel *clutter_list_model_new (guint n_columns,
...);
CLUTTER_DEPRECATED_FOR(g_list_store_new)
ClutterModel *clutter_list_model_newv (guint n_columns,
GType *types,
const gchar * const names[]);
G_END_DECLS
#endif /* __CLUTTER_LIST_MODEL_H__ */

View File

@ -1,664 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By: Matthew Allum <mallum@openedhand.com>
* Emmanuele Bassi <ebassi@linux.intel.com>
*
* Copyright (C) 2006 OpenedHand
* Copyright (C) 2009 Intel Corp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-media
* @short_description: An interface for controlling playback of media data
*
* #ClutterMedia is an interface for controlling playback of media sources.
*
* Clutter core does not provide an implementation of this interface, but
* other integration libraries like Clutter-GStreamer implement it to offer
* a uniform API for applications.
*
* #ClutterMedia is available since Clutter 0.2
*
* #ClutterMedia is deprecated since Clutter 1.12. Use the Clutter-GStreamer
* API directly instead.
*/
#include "clutter-build-config.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-debug.h"
#include "clutter-enum-types.h"
#include "clutter-marshal.h"
#include "clutter-media.h"
#include "clutter-main.h"
#include "clutter-private.h" /* for DBG */
enum
{
EOS_SIGNAL,
ERROR_SIGNAL, /* can't be called 'ERROR' otherwise it clashes with wingdi.h */
LAST_SIGNAL
};
static guint media_signals[LAST_SIGNAL] = { 0, };
typedef ClutterMediaIface ClutterMediaInterface;
G_DEFINE_INTERFACE (ClutterMedia, clutter_media, G_TYPE_OBJECT);
static void
clutter_media_default_init (ClutterMediaInterface *iface)
{
GParamSpec *pspec = NULL;
/**
* ClutterMedia:uri:
*
* The location of a media file, expressed as a valid URI.
*
* Since: 0.2
*
* Deprecated: 1.12
*/
pspec = g_param_spec_string ("uri",
P_("URI"),
P_("URI of a media file"),
NULL,
CLUTTER_PARAM_READWRITE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:playing:
*
* Whether the #ClutterMedia actor is playing.
*
* Since: 0.2
*
* Deprecated: 1.12
*/
pspec = g_param_spec_boolean ("playing",
P_("Playing"),
P_("Whether the actor is playing"),
FALSE,
CLUTTER_PARAM_READWRITE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:progress:
*
* The current progress of the playback, as a normalized
* value between 0.0 and 1.0.
*
* Since: 1.0
*
* Deprecated: 1.12
*/
pspec = g_param_spec_double ("progress",
P_("Progress"),
P_("Current progress of the playback"),
0.0, 1.0, 0.0,
CLUTTER_PARAM_READWRITE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:subtitle-uri:
*
* The location of a subtitle file, expressed as a valid URI.
*
* Since: 1.2
*
* Deprecated: 1.12
*/
pspec = g_param_spec_string ("subtitle-uri",
P_("Subtitle URI"),
P_("URI of a subtitle file"),
NULL,
CLUTTER_PARAM_READWRITE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:subtitle-font-name:
*
* The font used to display subtitles. The font description has to
* follow the same grammar as the one recognized by
* pango_font_description_from_string().
*
* Since: 1.2
*
* Deprecated: 1.12
*/
pspec = g_param_spec_string ("subtitle-font-name",
P_("Subtitle Font Name"),
P_("The font used to display subtitles"),
NULL,
CLUTTER_PARAM_READWRITE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:audio-volume:
*
* The volume of the audio, as a normalized value between
* 0.0 and 1.0.
*
* Since: 1.0
*
* Deprecated: 1.12
*/
pspec = g_param_spec_double ("audio-volume",
P_("Audio Volume"),
P_("The volume of the audio"),
0.0, 1.0, 0.5,
CLUTTER_PARAM_READWRITE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:can-seek:
*
* Whether the current stream is seekable.
*
* Since: 0.2
*
* Deprecated: 1.12
*/
pspec = g_param_spec_boolean ("can-seek",
P_("Can Seek"),
P_("Whether the current stream is seekable"),
FALSE,
CLUTTER_PARAM_READABLE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:buffer-fill:
*
* The fill level of the buffer for the current stream,
* as a value between 0.0 and 1.0.
*
* Since: 1.0
*
* Deprecated: 1.12
*/
pspec = g_param_spec_double ("buffer-fill",
P_("Buffer Fill"),
P_("The fill level of the buffer"),
0.0, 1.0, 0.0,
CLUTTER_PARAM_READABLE |
G_PARAM_DEPRECATED);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia:duration:
*
* The duration of the current stream, in seconds
*
* Since: 0.2
*
* Deprecated: 1.12
*/
pspec = g_param_spec_double ("duration",
P_("Duration"),
P_("The duration of the stream, in seconds"),
0, G_MAXDOUBLE, 0,
CLUTTER_PARAM_READABLE);
g_object_interface_install_property (iface, pspec);
/**
* ClutterMedia::eos:
* @media: the #ClutterMedia instance that received the signal
*
* The ::eos signal is emitted each time the media stream ends.
*
* Since: 0.2
*
* Deprecated: 1.12
*/
media_signals[EOS_SIGNAL] =
g_signal_new (I_("eos"),
CLUTTER_TYPE_MEDIA,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterMediaIface, eos),
NULL, NULL,
_clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* ClutterMedia::error:
* @media: the #ClutterMedia instance that received the signal
* @error: the #GError
*
* The ::error signal is emitted each time an error occurred.
*
* Since: 0.2
*
* Deprecated: 1.12
*/
media_signals[ERROR_SIGNAL] =
g_signal_new (I_("error"),
CLUTTER_TYPE_MEDIA,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterMediaIface, error),
NULL, NULL,
_clutter_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
G_TYPE_ERROR);
}
/**
* clutter_media_set_uri:
* @media: a #ClutterMedia
* @uri: the URI of the media stream
*
* Sets the URI of @media to @uri.
*
* Since: 0.2
*
* Deprecated: 1.12
*/
void
clutter_media_set_uri (ClutterMedia *media,
const gchar *uri)
{
g_return_if_fail (CLUTTER_IS_MEDIA(media));
g_object_set (G_OBJECT (media), "uri", uri, NULL);
}
/**
* clutter_media_get_uri:
* @media: a #ClutterMedia
*
* Retrieves the URI from @media.
*
* Return value: the URI of the media stream. Use g_free()
* to free the returned string
*
* Since: 0.2
*
* Deprecated: 1.12
*/
gchar *
clutter_media_get_uri (ClutterMedia *media)
{
gchar *retval = NULL;
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), NULL);
g_object_get (G_OBJECT (media), "uri", &retval, NULL);
return retval;
}
/**
* clutter_media_set_playing:
* @media: a #ClutterMedia
* @playing: %TRUE to start playing
*
* Starts or stops playing of @media.
* The implementation might be asynchronous, so the way to know whether
* the actual playing state of the @media is to use the #GObject::notify
* signal on the #ClutterMedia:playing property and then retrieve the
* current state with clutter_media_get_playing(). ClutterGstVideoTexture
* in clutter-gst is an example of such an asynchronous implementation.
*
* Since: 0.2
*
* Deprecated: 1.12
*/
void
clutter_media_set_playing (ClutterMedia *media,
gboolean playing)
{
g_return_if_fail (CLUTTER_IS_MEDIA(media));
g_object_set (G_OBJECT (media), "playing", playing, NULL);
}
/**
* clutter_media_get_playing:
* @media: A #ClutterMedia object
*
* Retrieves the playing status of @media.
*
* Return value: %TRUE if playing, %FALSE if stopped.
*
* Since: 0.2
*
* Deprecated: 1.12
*/
gboolean
clutter_media_get_playing (ClutterMedia *media)
{
gboolean is_playing = FALSE;
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), FALSE);
g_object_get (G_OBJECT (media), "playing", &is_playing, NULL);
return is_playing;
}
/**
* clutter_media_set_progress:
* @media: a #ClutterMedia
* @progress: the progress of the playback, between 0.0 and 1.0
*
* Sets the playback progress of @media. The @progress is
* a normalized value between 0.0 (begin) and 1.0 (end).
*
* Since: 1.0
*
* Deprecated: 1.12
*/
void
clutter_media_set_progress (ClutterMedia *media,
gdouble progress)
{
g_return_if_fail (CLUTTER_IS_MEDIA (media));
g_object_set (G_OBJECT (media), "progress", progress, NULL);
}
/**
* clutter_media_get_progress:
* @media: a #ClutterMedia
*
* Retrieves the playback progress of @media.
*
* Return value: the playback progress, between 0.0 and 1.0
*
* Since: 1.0
*
* Deprecated: 1.12
*/
gdouble
clutter_media_get_progress (ClutterMedia *media)
{
gdouble retval = 0.0;
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), 0);
g_object_get (G_OBJECT (media), "progress", &retval, NULL);
return retval;
}
/**
* clutter_media_set_subtitle_uri:
* @media: a #ClutterMedia
* @uri: the URI of a subtitle file
*
* Sets the location of a subtitle file to display while playing @media.
*
* Since: 1.2
*
* Deprecated: 1.12
*/
void
clutter_media_set_subtitle_uri (ClutterMedia *media,
const char *uri)
{
g_return_if_fail (CLUTTER_IS_MEDIA (media));
g_object_set (G_OBJECT (media), "subtitle-uri", uri, NULL);
}
/**
* clutter_media_get_subtitle_uri:
* @media: a #ClutterMedia
*
* Retrieves the URI of the subtitle file in use.
*
* Return value: the URI of the subtitle file. Use g_free()
* to free the returned string
*
* Since: 1.2
*
* Deprecated: 1.12
*/
gchar *
clutter_media_get_subtitle_uri (ClutterMedia *media)
{
gchar *retval = NULL;
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), NULL);
g_object_get (G_OBJECT (media), "subtitle-uri", &retval, NULL);
return retval;
}
/**
* clutter_media_set_subtitle_font_name:
* @media: a #ClutterMedia
* @font_name: a font name, or %NULL to set the default font name
*
* Sets the font used by the subtitle renderer. The @font_name string must be
* either %NULL, which means that the default font name of the underlying
* implementation will be used; or must follow the grammar recognized by
* pango_font_description_from_string() like:
*
* |[
* clutter_media_set_subtitle_font_name (media, "Sans 24pt");
* ]|
*
* Since: 1.2
*
* Deprecated: 1.12
*/
void
clutter_media_set_subtitle_font_name (ClutterMedia *media,
const char *font_name)
{
g_return_if_fail (CLUTTER_IS_MEDIA (media));
g_object_set (G_OBJECT (media), "subtitle-font-name", font_name, NULL);
}
/**
* clutter_media_get_subtitle_font_name:
* @media: a #ClutterMedia
*
* Retrieves the font name currently used.
*
* Return value: a string containing the font name. Use g_free()
* to free the returned string
*
* Since: 1.2
*
* Deprecated: 1.12
*/
gchar *
clutter_media_get_subtitle_font_name (ClutterMedia *media)
{
gchar *retval = NULL;
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), NULL);
g_object_get (G_OBJECT (media), "subtitle-font-name", &retval, NULL);
return retval;
}
/**
* clutter_media_set_audio_volume:
* @media: a #ClutterMedia
* @volume: the volume as a double between 0.0 and 1.0
*
* Sets the playback volume of @media to @volume.
*
* Since: 1.0
*
* Deprecated: 1.12
*/
void
clutter_media_set_audio_volume (ClutterMedia *media,
gdouble volume)
{
g_return_if_fail (CLUTTER_IS_MEDIA(media));
g_object_set (G_OBJECT (media), "audio-volume", volume, NULL);
}
/**
* clutter_media_get_audio_volume:
* @media: a #ClutterMedia
*
* Retrieves the playback volume of @media.
*
* Return value: The playback volume between 0.0 and 1.0
*
* Since: 1.0
*
* Deprecated: 1.12
*/
gdouble
clutter_media_get_audio_volume (ClutterMedia *media)
{
gdouble retval = 0.0;
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), 0.0);
g_object_get (G_OBJECT (media), "audio-volume", &retval, NULL);
return retval;
}
/**
* clutter_media_get_can_seek:
* @media: a #ClutterMedia
*
* Retrieves whether @media is seekable or not.
*
* Return value: %TRUE if @media can seek, %FALSE otherwise.
*
* Since: 0.2
*
* Deprecated: 1.12
*/
gboolean
clutter_media_get_can_seek (ClutterMedia *media)
{
gboolean retval = FALSE;
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), FALSE);
g_object_get (G_OBJECT (media), "can-seek", &retval, NULL);
return retval;
}
/**
* clutter_media_get_buffer_fill:
* @media: a #ClutterMedia
*
* Retrieves the amount of the stream that is buffered.
*
* Return value: the fill level, between 0.0 and 1.0
*
* Since: 1.0
*
* Deprecated: 1.12
*/
gdouble
clutter_media_get_buffer_fill (ClutterMedia *media)
{
gdouble retval = 0.0;
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), 0);
g_object_get (G_OBJECT (media), "buffer-fill", &retval, NULL);
return retval;
}
/**
* clutter_media_get_duration:
* @media: a #ClutterMedia
*
* Retrieves the duration of the media stream that @media represents.
*
* Return value: the duration of the media stream, in seconds
*
* Since: 0.2
*
* Deprecated: 1.12
*/
gdouble
clutter_media_get_duration (ClutterMedia *media)
{
gdouble retval = 0;
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), 0);
g_object_get (G_OBJECT (media), "duration", &retval, NULL);
return retval;
}
/* helper funcs */
/**
* clutter_media_set_filename:
* @media: a #ClutterMedia
* @filename: A filename
*
* Sets the source of @media using a file path.
*
* Since: 0.2
*
* Deprecated: 1.12
*/
void
clutter_media_set_filename (ClutterMedia *media,
const gchar *filename)
{
gchar *uri;
GError *uri_error = NULL;
if (!g_path_is_absolute (filename))
{
gchar *abs_path;
abs_path = g_build_filename (g_get_current_dir (), filename, NULL);
uri = g_filename_to_uri (abs_path, NULL, &uri_error);
g_free (abs_path);
}
else
uri = g_filename_to_uri (filename, NULL, &uri_error);
if (uri_error)
{
g_signal_emit (media, media_signals[ERROR_SIGNAL], 0, uri_error);
g_error_free (uri_error);
return;
}
clutter_media_set_uri (media, uri);
g_free (uri);
}

View File

@ -1,121 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By: Matthew Allum <mallum@openedhand.com>
* Emmanuele Bassi <ebassi@linux.intel.com>
*
* Copyright (C) 2006 OpenedHand
* Copyright (C) 2009 Intel Corp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_MEDIA_H__
#define __CLUTTER_MEDIA_H__
#include <glib-object.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_MEDIA (clutter_media_get_type ())
#define CLUTTER_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_MEDIA, ClutterMedia))
#define CLUTTER_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_MEDIA))
#define CLUTTER_MEDIA_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_MEDIA, ClutterMediaIface))
typedef struct _ClutterMedia ClutterMedia; /* dummy typedef */
typedef struct _ClutterMediaIface ClutterMediaIface;
/**
* ClutterMedia:
*
* #ClutterMedia is an opaque structure whose members cannot be directly
* accessed
*
* Since: 0.2
*/
/**
* ClutterMediaIface:
* @eos: handler for the #ClutterMedia::eos signal
* @error: handler for the #ClutterMedia::error signal
*
* Interface vtable for #ClutterMedia implementations
*
* Since: 0.2
*/
struct _ClutterMediaIface
{
/*< private >*/
GTypeInterface base_iface;
/*< public >*/
/* signals */
void (* eos) (ClutterMedia *media);
void (* error) (ClutterMedia *media,
const GError *error);
};
CLUTTER_DEPRECATED
GType clutter_media_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
void clutter_media_set_uri (ClutterMedia *media,
const gchar *uri);
CLUTTER_DEPRECATED
gchar * clutter_media_get_uri (ClutterMedia *media);
CLUTTER_DEPRECATED
void clutter_media_set_filename (ClutterMedia *media,
const gchar *filename);
CLUTTER_DEPRECATED
void clutter_media_set_playing (ClutterMedia *media,
gboolean playing);
CLUTTER_DEPRECATED
gboolean clutter_media_get_playing (ClutterMedia *media);
CLUTTER_DEPRECATED
void clutter_media_set_progress (ClutterMedia *media,
gdouble progress);
CLUTTER_DEPRECATED
gdouble clutter_media_get_progress (ClutterMedia *media);
CLUTTER_DEPRECATED
void clutter_media_set_subtitle_uri (ClutterMedia *media,
const gchar *uri);
CLUTTER_DEPRECATED
gchar * clutter_media_get_subtitle_uri (ClutterMedia *media);
CLUTTER_DEPRECATED
void clutter_media_set_subtitle_font_name (ClutterMedia *media,
const char *font_name);
CLUTTER_DEPRECATED
gchar * clutter_media_get_subtitle_font_name (ClutterMedia *media);
CLUTTER_DEPRECATED
void clutter_media_set_audio_volume (ClutterMedia *media,
gdouble volume);
CLUTTER_DEPRECATED
gdouble clutter_media_get_audio_volume (ClutterMedia *media);
CLUTTER_DEPRECATED
gboolean clutter_media_get_can_seek (ClutterMedia *media);
CLUTTER_DEPRECATED
gdouble clutter_media_get_buffer_fill (ClutterMedia *media);
CLUTTER_DEPRECATED
gdouble clutter_media_get_duration (ClutterMedia *media);
G_END_DECLS
#endif /* __CLUTTER_MEDIA_H__ */

View File

@ -1,52 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Neil Jagdish Patel <njp@o-hand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CLUTTER_MODEL_PRIVATE_H__
#define __CLUTTER_MODEL_PRIVATE_H__
#include "clutter-types.h"
#include "clutter-model.h"
G_BEGIN_DECLS
void _clutter_model_set_n_columns (ClutterModel *model,
gint n_columns,
gboolean set_types,
gboolean set_names);
gboolean _clutter_model_check_type (GType gtype);
void _clutter_model_set_column_type (ClutterModel *model,
gint column,
GType gtype);
void _clutter_model_set_column_name (ClutterModel *model,
gint column,
const gchar *name);
void _clutter_model_iter_set_row (ClutterModelIter *iter,
guint row);
G_END_DECLS
#endif /* __CLUTTER_MODEL_PRIVATE_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,436 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Neil Jagdish Patel <njp@o-hand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_MODEL_H__
#define __CLUTTER_MODEL_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_MODEL (clutter_model_get_type ())
#define CLUTTER_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_MODEL, ClutterModel))
#define CLUTTER_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_MODEL, ClutterModelClass))
#define CLUTTER_IS_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_MODEL))
#define CLUTTER_IS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_MODEL))
#define CLUTTER_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_MODEL, ClutterModelClass))
typedef struct _ClutterModel ClutterModel;
typedef struct _ClutterModelClass ClutterModelClass;
typedef struct _ClutterModelPrivate ClutterModelPrivate;
typedef struct _ClutterModelIter ClutterModelIter;
typedef struct _ClutterModelIterClass ClutterModelIterClass;
typedef struct _ClutterModelIterPrivate ClutterModelIterPrivate;
/**
* ClutterModelFilterFunc:
* @model: a #ClutterModel
* @iter: the iterator for the row
* @user_data: data passed to clutter_model_set_filter()
*
* Filters the content of a row in the model.
*
* Return value: If the row should be displayed, return %TRUE
*
* Since: 0.6
*
* Deprecated: 1.24: Implement filters using a custom #GListModel instead
*/
typedef gboolean (*ClutterModelFilterFunc) (ClutterModel *model,
ClutterModelIter *iter,
gpointer user_data);
/**
* ClutterModelSortFunc:
* @model: a #ClutterModel
* @a: a #GValue representing the contents of the row
* @b: a #GValue representing the contents of the second row
* @user_data: data passed to clutter_model_set_sort()
*
* Compares the content of two rows in the model.
*
* Return value: a positive integer if @a is after @b, a negative integer if
* @a is before @b, or 0 if the rows are the same
*
* Since: 0.6
*
* Deprecated: 1.24: Implement sorting using a custom #GListModel instead
*/
typedef gint (*ClutterModelSortFunc) (ClutterModel *model,
const GValue *a,
const GValue *b,
gpointer user_data);
/**
* ClutterModelForeachFunc:
* @model: a #ClutterModel
* @iter: the iterator for the row
* @user_data: data passed to clutter_model_foreach()
*
* Iterates on the content of a row in the model
*
* Return value: %TRUE if the iteration should continue, %FALSE otherwise
*
* Since: 0.6
*
* Deprecated: 1.24: Use #GListModel
*/
typedef gboolean (*ClutterModelForeachFunc) (ClutterModel *model,
ClutterModelIter *iter,
gpointer user_data);
/**
* ClutterModel:
*
* Base class for list models. The #ClutterModel structure contains
* only private data and should be manipulated using the provided
* API.
*
* Since: 0.6
*
* Deprecated: 1.24: Use #GListModel instead
*/
struct _ClutterModel
{
/*< private >*/
GObject parent_instance;
ClutterModelPrivate *priv;
};
/**
* ClutterModelClass:
* @row_added: signal class handler for ClutterModel::row-added
* @row_removed: signal class handler for ClutterModel::row-removed
* @row_changed: signal class handler for ClutterModel::row-changed
* @sort_changed: signal class handler for ClutterModel::sort-changed
* @filter_changed: signal class handler for ClutterModel::filter-changed
* @get_column_name: virtual function for returning the name of a column
* @get_column_type: virtual function for returning the type of a column
* @get_iter_at_row: virtual function for returning an iterator for the
* given row
* @get_n_rows: virtual function for returning the number of rows
* of the model
* @get_n_columns: virtual function for retuning the number of columns
* of the model
* @resort: virtual function for sorting the model using the passed
* sorting function
* @insert_row: virtual function for inserting a row at the given index
* and returning an iterator pointing to it; if the index is a negative
* integer, the row should be appended to the model
* @remove_row: virtual function for removing a row at the given index
*
* Class for #ClutterModel instances.
*
* Since: 0.6
*
* Deprecated: 1.24: Use #GListModel instead
*/
struct _ClutterModelClass
{
/*< private >*/
GObjectClass parent_class;
/*< public >*/
/* vtable */
guint (* get_n_rows) (ClutterModel *model);
guint (* get_n_columns) (ClutterModel *model);
const gchar * (* get_column_name) (ClutterModel *model,
guint column);
GType (* get_column_type) (ClutterModel *model,
guint column);
ClutterModelIter *(* insert_row) (ClutterModel *model,
gint index_);
void (* remove_row) (ClutterModel *model,
guint row);
ClutterModelIter *(* get_iter_at_row) (ClutterModel *model,
guint row);
void (* resort) (ClutterModel *model,
ClutterModelSortFunc func,
gpointer data);
/* signals */
void (* row_added) (ClutterModel *model,
ClutterModelIter *iter);
void (* row_removed) (ClutterModel *model,
ClutterModelIter *iter);
void (* row_changed) (ClutterModel *model,
ClutterModelIter *iter);
void (* sort_changed) (ClutterModel *model);
void (* filter_changed) (ClutterModel *model);
/*< private >*/
/* padding for future expansion */
void (*_clutter_model_1) (void);
void (*_clutter_model_2) (void);
void (*_clutter_model_3) (void);
void (*_clutter_model_4) (void);
void (*_clutter_model_5) (void);
void (*_clutter_model_6) (void);
void (*_clutter_model_7) (void);
void (*_clutter_model_8) (void);
};
CLUTTER_DEPRECATED_FOR(g_list_model_get_type)
GType clutter_model_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_set_types (ClutterModel *model,
guint n_columns,
GType *types);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_set_names (ClutterModel *model,
guint n_columns,
const gchar * const names[]);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_append (ClutterModel *model,
...);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_appendv (ClutterModel *model,
guint n_columns,
guint *columns,
GValue *values);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_prepend (ClutterModel *model,
...);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_prependv (ClutterModel *model,
guint n_columns,
guint *columns,
GValue *values);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_insert (ClutterModel *model,
guint row,
...);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_insertv (ClutterModel *model,
guint row,
guint n_columns,
guint *columns,
GValue *values);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_insert_value (ClutterModel *model,
guint row,
guint column,
const GValue *value);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_remove (ClutterModel *model,
guint row);
CLUTTER_DEPRECATED_FOR(GListModel)
guint clutter_model_get_n_rows (ClutterModel *model);
CLUTTER_DEPRECATED_FOR(GListModel)
guint clutter_model_get_n_columns (ClutterModel *model);
CLUTTER_DEPRECATED_FOR(GListModel)
const gchar * clutter_model_get_column_name (ClutterModel *model,
guint column);
CLUTTER_DEPRECATED_FOR(GListModel)
GType clutter_model_get_column_type (ClutterModel *model,
guint column);
CLUTTER_DEPRECATED_FOR(GListModel)
ClutterModelIter * clutter_model_get_first_iter (ClutterModel *model);
CLUTTER_DEPRECATED_FOR(GListModel)
ClutterModelIter * clutter_model_get_last_iter (ClutterModel *model);
CLUTTER_DEPRECATED_FOR(GListModel)
ClutterModelIter * clutter_model_get_iter_at_row (ClutterModel *model,
guint row);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_set_sorting_column (ClutterModel *model,
gint column);
CLUTTER_DEPRECATED_FOR(GListModel)
gint clutter_model_get_sorting_column (ClutterModel *model);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_foreach (ClutterModel *model,
ClutterModelForeachFunc func,
gpointer user_data);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_set_sort (ClutterModel *model,
gint column,
ClutterModelSortFunc func,
gpointer user_data,
GDestroyNotify notify);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_set_filter (ClutterModel *model,
ClutterModelFilterFunc func,
gpointer user_data,
GDestroyNotify notify);
CLUTTER_DEPRECATED_FOR(GListModel)
gboolean clutter_model_get_filter_set (ClutterModel *model);
CLUTTER_DEPRECATED_FOR(GListModel)
void clutter_model_resort (ClutterModel *model);
CLUTTER_DEPRECATED_FOR(GListModel)
gboolean clutter_model_filter_row (ClutterModel *model,
guint row);
CLUTTER_DEPRECATED_FOR(GListModel)
gboolean clutter_model_filter_iter (ClutterModel *model,
ClutterModelIter *iter);
/*
* ClutterModelIter
*/
#define CLUTTER_TYPE_MODEL_ITER (clutter_model_iter_get_type ())
#define CLUTTER_MODEL_ITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_MODEL_ITER, ClutterModelIter))
#define CLUTTER_MODEL_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_MODEL_ITER, ClutterModelIterClass))
#define CLUTTER_IS_MODEL_ITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_MODEL_ITER))
#define CLUTTER_IS_MODEL_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_MODEL_ITER))
#define CLUTTER_MODEL_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_MODEL_ITER, ClutterModelIterClass))
/**
* ClutterModelIter:
*
* Base class for list models iters. The #ClutterModelIter structure
* contains only private data and should be manipulated using the
* provided API.
*
* Since: 0.6
*
* Deprecated: 1.24: Use custom iterators for #GListModel
*/
struct _ClutterModelIter
{
/*< private >*/
GObject parent_instance;
ClutterModelIterPrivate *priv;
};
/**
* ClutterModelIterClass:
* @get_value: Virtual function for retrieving the value at the given
* column of the row pointed by the iterator
* @set_value: Virtual function for setting the value at the given
* column of the row pointer by the iterator
* @is_last: Virtual function for knowing whether the iterator points
* at the last row in the model
* @is_first: Virtual function for knowing whether the iterator points
* at the first row in the model
* @next: Virtual function for moving the iterator to the following
* row in the model
* @prev: Virtual function for moving the iterator toe the previous
* row in the model
* @get_model: Virtual function for getting the model to which the
* iterator belongs to
* @get_row: Virtual function for getting the row to which the iterator
* points
* @copy: Virtual function for copying a #ClutterModelIter.
*
* Class for #ClutterModelIter instances.
*
* Since: 0.6
*
* Deprecated: 1.24: Use custom iterators for #GListModel
*/
struct _ClutterModelIterClass
{
/*< private >*/
GObjectClass parent_class;
/*< public >*/
/* vtable not signals */
void (* get_value) (ClutterModelIter *iter,
guint column,
GValue *value);
void (* set_value) (ClutterModelIter *iter,
guint column,
const GValue *value);
gboolean (* is_first) (ClutterModelIter *iter);
gboolean (* is_last) (ClutterModelIter *iter);
ClutterModelIter *(* next) (ClutterModelIter *iter);
ClutterModelIter *(* prev) (ClutterModelIter *iter);
ClutterModel * (* get_model) (ClutterModelIter *iter);
guint (* get_row) (ClutterModelIter *iter);
ClutterModelIter *(* copy) (ClutterModelIter *iter);
/*< private >*/
/* padding for future expansion */
void (*_clutter_model_iter_1) (void);
void (*_clutter_model_iter_2) (void);
void (*_clutter_model_iter_3) (void);
void (*_clutter_model_iter_4) (void);
void (*_clutter_model_iter_5) (void);
void (*_clutter_model_iter_6) (void);
void (*_clutter_model_iter_7) (void);
void (*_clutter_model_iter_8) (void);
};
CLUTTER_DEPRECATED
GType clutter_model_iter_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
void clutter_model_iter_get (ClutterModelIter *iter,
...);
CLUTTER_DEPRECATED
void clutter_model_iter_get_valist (ClutterModelIter *iter,
va_list args);
CLUTTER_DEPRECATED
void clutter_model_iter_get_value (ClutterModelIter *iter,
guint column,
GValue *value);
CLUTTER_DEPRECATED
void clutter_model_iter_set (ClutterModelIter *iter,
...);
CLUTTER_DEPRECATED
void clutter_model_iter_set_valist (ClutterModelIter *iter,
va_list args);
CLUTTER_DEPRECATED
void clutter_model_iter_set_value (ClutterModelIter *iter,
guint column,
const GValue *value);
CLUTTER_DEPRECATED
gboolean clutter_model_iter_is_first (ClutterModelIter *iter);
CLUTTER_DEPRECATED
gboolean clutter_model_iter_is_last (ClutterModelIter *iter);
CLUTTER_DEPRECATED
ClutterModelIter *clutter_model_iter_next (ClutterModelIter *iter);
CLUTTER_DEPRECATED
ClutterModelIter *clutter_model_iter_prev (ClutterModelIter *iter);
CLUTTER_DEPRECATED
ClutterModel * clutter_model_iter_get_model (ClutterModelIter *iter);
CLUTTER_DEPRECATED
guint clutter_model_iter_get_row (ClutterModelIter *iter);
CLUTTER_DEPRECATED
ClutterModelIter *clutter_model_iter_copy (ClutterModelIter *iter);
G_END_DECLS
#endif /* __CLUTTER_MODEL_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,144 +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/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_SCORE_H__
#define __CLUTTER_SCORE_H__
#include <clutter/clutter-timeline.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_SCORE (clutter_score_get_type ())
#define CLUTTER_SCORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SCORE, ClutterScore))
#define CLUTTER_SCORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SCORE, ClutterScoreClass))
#define CLUTTER_IS_SCORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SCORE))
#define CLUTTER_IS_SCORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SCORE))
#define CLUTTER_SCORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SCORE, ClutterScoreClass))
typedef struct _ClutterScore ClutterScore;
typedef struct _ClutterScorePrivate ClutterScorePrivate;
typedef struct _ClutterScoreClass ClutterScoreClass;
/**
* ClutterScore:
*
* The #ClutterScore structure contains only private data
* and should be accessed using the provided API
*
* Since: 0.6
*/
struct _ClutterScore
{
/*< private >*/
GObject parent;
ClutterScorePrivate *priv;
};
/**
* ClutterScoreClass:
* @timeline_started: handler for the #ClutterScore::timeline-started signal
* @timeline_completed: handler for the #ClutterScore::timeline-completed
* signal
* @started: handler for the #ClutterScore::started signal
* @completed: handler for the #ClutterScore::completed signal
* @paused: handler for the #ClutterScore::paused signal
*
* The #ClutterScoreClass structure contains only private data
*
* Since: 0.6
*/
struct _ClutterScoreClass
{
/*< private >*/
GObjectClass parent_class;
/*< public >*/
void (* timeline_started) (ClutterScore *score,
ClutterTimeline *timeline);
void (* timeline_completed) (ClutterScore *score,
ClutterTimeline *timeline);
void (* started) (ClutterScore *score);
void (* completed) (ClutterScore *score);
void (* paused) (ClutterScore *score);
/*< private >*/
/* padding for future expansion */
void (*_clutter_score_1) (void);
void (*_clutter_score_2) (void);
void (*_clutter_score_3) (void);
void (*_clutter_score_4) (void);
void (*_clutter_score_5) (void);
};
CLUTTER_DEPRECATED
GType clutter_score_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
ClutterScore * clutter_score_new (void);
CLUTTER_DEPRECATED
void clutter_score_set_loop (ClutterScore *score,
gboolean loop);
CLUTTER_DEPRECATED
gboolean clutter_score_get_loop (ClutterScore *score);
CLUTTER_DEPRECATED
gulong clutter_score_append (ClutterScore *score,
ClutterTimeline *parent,
ClutterTimeline *timeline);
CLUTTER_DEPRECATED
gulong clutter_score_append_at_marker (ClutterScore *score,
ClutterTimeline *parent,
const gchar *marker_name,
ClutterTimeline *timeline);
CLUTTER_DEPRECATED
void clutter_score_remove (ClutterScore *score,
gulong id_);
CLUTTER_DEPRECATED
void clutter_score_remove_all (ClutterScore *score);
CLUTTER_DEPRECATED
ClutterTimeline *clutter_score_get_timeline (ClutterScore *score,
gulong id_);
CLUTTER_DEPRECATED
GSList * clutter_score_list_timelines (ClutterScore *score);
CLUTTER_DEPRECATED
void clutter_score_start (ClutterScore *score);
CLUTTER_DEPRECATED
void clutter_score_stop (ClutterScore *score);
CLUTTER_DEPRECATED
void clutter_score_pause (ClutterScore *score);
CLUTTER_DEPRECATED
void clutter_score_rewind (ClutterScore *score);
CLUTTER_DEPRECATED
gboolean clutter_score_is_playing (ClutterScore *score);
G_END_DECLS
#endif /* __CLUTTER_SCORE_H__ */

View File

@ -1,907 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By: Matthew Allum <mallum@openedhand.com>
* Øyvind Kolås <pippin@o-hand.com>
* Emmanuele Bassi <ebassi@linux.intel.com>
*
* Copyright (C) 2007, 2008 OpenedHand
* Copyright (C) 2009 Intel Corp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
/**
* SECTION:clutter-shader
* @short_description: Programmable pipeline abstraction
*
* #ClutterShader is an object providing an abstraction over the
* OpenGL programmable pipeline. By using #ClutterShader<!-- -->s is
* possible to override the drawing pipeline by using small programs
* also known as "shaders".
*
* #ClutterShader is available since Clutter 0.6.
*
* #ClutterShader is deprecated since Clutter 1.8; use #ClutterShaderEffect
* in newly written code, instead.
*/
#include "clutter-build-config.h"
#include <string.h>
#include <stdlib.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <glib.h>
#include <cogl/cogl.h>
#include "clutter-shader.h"
#include "clutter-debug.h"
#include "clutter-private.h"
/* global list of shaders */
static GList *clutter_shaders_list = NULL;
struct _ClutterShaderPrivate
{
guint compiled : 1; /* Shader is bound to the GL context */
guint is_enabled : 1;
gchar *vertex_source; /* GLSL source for vertex shader */
gchar *fragment_source; /* GLSL source for fragment shader */
CoglHandle program;
CoglHandle vertex_shader;
CoglHandle fragment_shader;
};
enum
{
PROP_0,
PROP_VERTEX_SOURCE,
PROP_FRAGMENT_SOURCE,
PROP_COMPILED,
PROP_ENABLED,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
G_DEFINE_TYPE_WITH_PRIVATE (ClutterShader, clutter_shader, G_TYPE_OBJECT)
static inline void
clutter_shader_release_internal (ClutterShader *shader)
{
ClutterShaderPrivate *priv = shader->priv;
if (!priv->compiled)
return;
g_assert (priv->program != COGL_INVALID_HANDLE);
if (priv->vertex_shader != COGL_INVALID_HANDLE)
cogl_handle_unref (priv->vertex_shader);
if (priv->fragment_shader != COGL_INVALID_HANDLE)
cogl_handle_unref (priv->fragment_shader);
if (priv->program != COGL_INVALID_HANDLE)
cogl_handle_unref (priv->program);
priv->vertex_shader = COGL_INVALID_HANDLE;
priv->fragment_shader = COGL_INVALID_HANDLE;
priv->program = COGL_INVALID_HANDLE;
priv->compiled = FALSE;
}
static void
clutter_shader_finalize (GObject *object)
{
ClutterShader *shader;
ClutterShaderPrivate *priv;
shader = CLUTTER_SHADER (object);
priv = shader->priv;
clutter_shaders_list = g_list_remove (clutter_shaders_list, object);
g_free (priv->fragment_source);
g_free (priv->vertex_source);
G_OBJECT_CLASS (clutter_shader_parent_class)->finalize (object);
}
static void
clutter_shader_dispose (GObject *object)
{
ClutterShader *shader = CLUTTER_SHADER (object);
clutter_shader_release_internal (shader);
G_OBJECT_CLASS (clutter_shader_parent_class)->finalize (object);
}
static void
clutter_shader_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterShader *shader = CLUTTER_SHADER(object);
switch (prop_id)
{
case PROP_VERTEX_SOURCE:
clutter_shader_set_vertex_source (shader,
g_value_get_string (value), -1);
break;
case PROP_FRAGMENT_SOURCE:
clutter_shader_set_fragment_source (shader,
g_value_get_string (value), -1);
break;
case PROP_ENABLED:
clutter_shader_set_is_enabled (shader, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_shader_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterShader *shader;
ClutterShaderPrivate *priv;
shader = CLUTTER_SHADER(object);
priv = shader->priv;
switch (prop_id)
{
case PROP_VERTEX_SOURCE:
g_value_set_string (value, priv->vertex_source);
break;
case PROP_FRAGMENT_SOURCE:
g_value_set_string (value, priv->fragment_source);
break;
case PROP_COMPILED:
g_value_set_boolean (value, priv->compiled);
break;
case PROP_ENABLED:
g_value_set_boolean (value, priv->is_enabled);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static GObject *
clutter_shader_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
{
GObjectClass *parent_class;
GObject *object;
parent_class = G_OBJECT_CLASS (clutter_shader_parent_class);
object = parent_class->constructor (type, n_params, params);
/* add this instance to the global list of shaders */
clutter_shaders_list = g_list_prepend (clutter_shaders_list, object);
return object;
}
static void
clutter_shader_class_init (ClutterShaderClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec = NULL;
object_class->finalize = clutter_shader_finalize;
object_class->dispose = clutter_shader_dispose;
object_class->set_property = clutter_shader_set_property;
object_class->get_property = clutter_shader_get_property;
object_class->constructor = clutter_shader_constructor;
/**
* ClutterShader:vertex-source:
*
* GLSL source code for the vertex shader part of the shader
* program, if any
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
pspec = g_param_spec_string ("vertex-source",
P_("Vertex Source"),
P_("Source of vertex shader"),
NULL,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_VERTEX_SOURCE] = pspec;
g_object_class_install_property (object_class, PROP_VERTEX_SOURCE, pspec);
/**
* ClutterShader:fragment-source:
*
* GLSL source code for the fragment shader part of the shader program.
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
pspec = g_param_spec_string ("fragment-source",
P_("Fragment Source"),
P_("Source of fragment shader"),
NULL,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_FRAGMENT_SOURCE] = pspec;
g_object_class_install_property (object_class, PROP_FRAGMENT_SOURCE, pspec);
/**
* ClutterShader:compiled:
*
* Whether the shader is compiled and linked, ready for use
* in the GL context.
*
* Since: 0.8
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
pspec = g_param_spec_boolean ("compiled",
P_("Compiled"),
P_("Whether the shader is compiled and linked"),
FALSE,
CLUTTER_PARAM_READABLE);
obj_props[PROP_COMPILED] = pspec;
g_object_class_install_property (object_class, PROP_COMPILED, pspec);
/**
* ClutterShader:enabled:
*
* Whether the shader is currently used in the GL rendering pipeline.
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
pspec = g_param_spec_boolean ("enabled",
P_("Enabled"),
P_("Whether the shader is enabled"),
FALSE,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_ENABLED] = pspec;
g_object_class_install_property (object_class, PROP_ENABLED, pspec);
}
static void
clutter_shader_init (ClutterShader *self)
{
ClutterShaderPrivate *priv;
priv = self->priv = clutter_shader_get_instance_private (self);
priv->compiled = FALSE;
priv->vertex_source = NULL;
priv->fragment_source = NULL;
priv->program = COGL_INVALID_HANDLE;
priv->vertex_shader = COGL_INVALID_HANDLE;
priv->fragment_shader = COGL_INVALID_HANDLE;
}
/**
* clutter_shader_new:
*
* Create a new #ClutterShader instance.
*
* Return value: a new #ClutterShader.
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
ClutterShader *
clutter_shader_new (void)
{
return g_object_new (CLUTTER_TYPE_SHADER, NULL);
}
static inline void
clutter_shader_set_source (ClutterShader *shader,
ClutterShaderType shader_type,
const gchar *data,
gssize length)
{
ClutterShaderPrivate *priv = shader->priv;
if (length < 0)
length = strlen (data);
g_object_freeze_notify (G_OBJECT (shader));
/* release shader if bound when changing the source, the shader will
* automatically be rebound on the next use.
*/
if (clutter_shader_is_compiled (shader))
clutter_shader_release (shader);
CLUTTER_NOTE (SHADER,
"setting %s shader (len:%" G_GSSIZE_FORMAT ")",
shader_type == CLUTTER_VERTEX_SHADER ? "vertex" : "fragment",
length);
switch (shader_type)
{
case CLUTTER_FRAGMENT_SHADER:
g_free (priv->fragment_source);
priv->fragment_source = g_strndup (data, length);
g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_FRAGMENT_SOURCE]);
break;
case CLUTTER_VERTEX_SHADER:
g_free (priv->vertex_source);
priv->vertex_source = g_strndup (data, length);
g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_VERTEX_SOURCE]);
break;
}
g_object_thaw_notify (G_OBJECT (shader));
}
/**
* clutter_shader_set_fragment_source:
* @shader: a #ClutterShader
* @data: GLSL source code.
* @length: length of source buffer (currently ignored)
*
* Sets the GLSL source code to be used by a #ClutterShader for the fragment
* program.
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
void
clutter_shader_set_fragment_source (ClutterShader *shader,
const gchar *data,
gssize length)
{
g_return_if_fail (CLUTTER_IS_SHADER (shader));
g_return_if_fail (data != NULL);
clutter_shader_set_source (shader, CLUTTER_FRAGMENT_SHADER, data, length);
}
/**
* clutter_shader_set_vertex_source:
* @shader: a #ClutterShader
* @data: GLSL source code.
* @length: length of source buffer (currently ignored)
*
* Sets the GLSL source code to be used by a #ClutterShader for the vertex
* program.
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
void
clutter_shader_set_vertex_source (ClutterShader *shader,
const gchar *data,
gssize length)
{
g_return_if_fail (CLUTTER_IS_SHADER (shader));
g_return_if_fail (data != NULL);
clutter_shader_set_source (shader, CLUTTER_VERTEX_SHADER, data, length);
}
static const gchar *
clutter_shader_get_source (ClutterShader *shader,
ClutterShaderType shader_type)
{
switch (shader_type)
{
case CLUTTER_FRAGMENT_SHADER:
return shader->priv->fragment_source;
case CLUTTER_VERTEX_SHADER:
return shader->priv->vertex_source;
}
return NULL;
}
static CoglHandle
clutter_shader_get_cogl_shader (ClutterShader *shader,
ClutterShaderType shader_type)
{
switch (shader_type)
{
case CLUTTER_FRAGMENT_SHADER:
return shader->priv->fragment_shader;
case CLUTTER_VERTEX_SHADER:
return shader->priv->vertex_shader;
}
return COGL_INVALID_HANDLE;
}
static gboolean
clutter_shader_glsl_bind (ClutterShader *self,
ClutterShaderType shader_type,
GError **error)
{
ClutterShaderPrivate *priv = self->priv;
CoglHandle shader = COGL_INVALID_HANDLE;
switch (shader_type)
{
case CLUTTER_VERTEX_SHADER:
shader = cogl_create_shader (COGL_SHADER_TYPE_VERTEX);
cogl_shader_source (shader, priv->vertex_source);
priv->vertex_shader = shader;
break;
case CLUTTER_FRAGMENT_SHADER:
shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
cogl_shader_source (shader, priv->fragment_source);
priv->fragment_shader = shader;
break;
}
g_assert (shader != COGL_INVALID_HANDLE);
cogl_shader_compile (shader);
if (!cogl_shader_is_compiled (shader))
{
gchar *log_buf;
log_buf = cogl_shader_get_info_log (shader);
/* translators: the first %s is the type of the shader, either
* Vertex shader or Fragment shader; the second %s is the actual
* error as reported by COGL
*/
g_set_error (error, CLUTTER_SHADER_ERROR,
CLUTTER_SHADER_ERROR_COMPILE,
_("%s compilation failed: %s"),
shader_type == CLUTTER_VERTEX_SHADER ? _("Vertex shader")
: _("Fragment shader"),
log_buf);
g_free (log_buf);
return FALSE;
}
cogl_program_attach_shader (priv->program, shader);
return TRUE;
}
static gboolean
bind_glsl_shader (ClutterShader *self,
GError **error)
{
ClutterShaderPrivate *priv = self->priv;
GError *bind_error = NULL;
gboolean res;
priv->program = cogl_create_program ();
if (priv->vertex_source != COGL_INVALID_HANDLE)
{
res = clutter_shader_glsl_bind (self,
CLUTTER_VERTEX_SHADER,
&bind_error);
if (!res)
{
g_propagate_error (error, bind_error);
return FALSE;
}
}
if (priv->fragment_source != COGL_INVALID_HANDLE)
{
res = clutter_shader_glsl_bind (self,
CLUTTER_FRAGMENT_SHADER,
&bind_error);
if (!res)
{
g_propagate_error (error, bind_error);
return FALSE;
}
}
cogl_program_link (priv->program);
return TRUE;
}
/**
* clutter_shader_compile:
* @shader: a #ClutterShader
* @error: return location for a #GError, or %NULL
*
* Compiles and links GLSL sources set for vertex and fragment shaders for
* a #ClutterShader. If the compilation fails and a #GError return location is
* provided the error will contain the errors from the compiler, if any.
*
* Return value: returns TRUE if the shader was succesfully compiled.
*
* Since: 0.8
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
gboolean
clutter_shader_compile (ClutterShader *shader,
GError **error)
{
ClutterShaderPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), FALSE);
priv = shader->priv;
if (priv->compiled)
return priv->compiled;
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
{
g_set_error (error, CLUTTER_SHADER_ERROR,
CLUTTER_SHADER_ERROR_NO_GLSL,
"GLSL shaders not supported");
priv->compiled = FALSE;
return priv->compiled;
}
priv->compiled = bind_glsl_shader (shader, error);
g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_COMPILED]);
return priv->compiled;
}
/**
* clutter_shader_release:
* @shader: a #ClutterShader
*
* Frees up any GL context resources held by the shader.
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
void
clutter_shader_release (ClutterShader *shader)
{
g_return_if_fail (CLUTTER_IS_SHADER (shader));
clutter_shader_release_internal (shader);
g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_COMPILED]);
}
/**
* clutter_shader_is_compiled:
* @shader: a #ClutterShader
*
* Checks whether @shader is is currently compiled, linked and bound
* to the GL context.
*
* Return value: %TRUE if the shader is compiled, linked and ready for use.
*
* Since: 0.8
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
gboolean
clutter_shader_is_compiled (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), FALSE);
return shader->priv->compiled;
}
/**
* clutter_shader_set_is_enabled:
* @shader: a #ClutterShader
* @enabled: The new state of the shader.
*
* Enables a shader. This function will attempt to compile and link
* the shader, if it isn't already.
*
* When @enabled is %FALSE the default state of the GL pipeline will be
* used instead.
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
void
clutter_shader_set_is_enabled (ClutterShader *shader,
gboolean enabled)
{
ClutterShaderPrivate *priv;
g_return_if_fail (CLUTTER_IS_SHADER (shader));
priv = shader->priv;
if (priv->is_enabled != enabled)
{
GError *error = NULL;
gboolean res;
res = clutter_shader_compile (shader, &error);
if (!res)
{
g_warning ("Unable to bind the shader: %s",
error ? error->message : "unknown error");
if (error)
g_error_free (error);
return;
}
priv->is_enabled = enabled;
if (priv->is_enabled)
cogl_program_use (priv->program);
else
cogl_program_use (COGL_INVALID_HANDLE);
g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_ENABLED]);
}
}
/**
* clutter_shader_get_is_enabled:
* @shader: a #ClutterShader
*
* Checks whether @shader is enabled.
*
* Return value: %TRUE if the shader is enabled.
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
gboolean
clutter_shader_get_is_enabled (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), FALSE);
return shader->priv->is_enabled;
}
/**
* clutter_shader_set_uniform:
* @shader: a #ClutterShader.
* @name: name of uniform in GLSL shader program to set.
* @value: a #ClutterShaderFloat, #ClutterShaderInt or #ClutterShaderMatrix
* #GValue.
*
* Sets a user configurable variable in the GLSL shader programs attached to
* a #ClutterShader.
*
* Since: 1.0
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
void
clutter_shader_set_uniform (ClutterShader *shader,
const gchar *name,
const GValue *value)
{
ClutterShaderPrivate *priv;
int location = 0;
gsize size;
g_return_if_fail (CLUTTER_IS_SHADER (shader));
g_return_if_fail (name != NULL);
g_return_if_fail (value != NULL);
g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value) ||
CLUTTER_VALUE_HOLDS_SHADER_INT (value) ||
CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value) ||
G_VALUE_HOLDS_FLOAT (value) ||
G_VALUE_HOLDS_INT (value));
priv = shader->priv;
g_return_if_fail (priv->program != COGL_INVALID_HANDLE);
location = cogl_program_get_uniform_location (priv->program, name);
if (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value))
{
const float *floats;
floats = clutter_value_get_shader_float (value, &size);
cogl_program_set_uniform_float (priv->program,
location, size, 1, floats);
}
else if (CLUTTER_VALUE_HOLDS_SHADER_INT (value))
{
const int *ints;
ints = clutter_value_get_shader_int (value, &size);
cogl_program_set_uniform_int (priv->program,
location, size, 1, ints);
}
else if (CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value))
{
const float *matrix;
matrix = clutter_value_get_shader_matrix (value, &size);
cogl_program_set_uniform_matrix (priv->program,
location, size, 1, FALSE, matrix);
}
else if (G_VALUE_HOLDS_FLOAT (value))
{
float float_val = g_value_get_float (value);
cogl_program_set_uniform_float (priv->program,
location, 1, 1, &float_val);
}
else if (G_VALUE_HOLDS_INT (value))
{
int int_val = g_value_get_int (value);
cogl_program_set_uniform_int (priv->program,
location, 1, 1, &int_val);
}
else
g_assert_not_reached ();
}
/**
* clutter_shader_get_fragment_source:
* @shader: a #ClutterShader
*
* Query the current GLSL fragment source set on @shader.
*
* Return value: the source of the fragment shader for this
* ClutterShader object or %NULL. The returned string is owned by the
* shader object and should never be modified or freed
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
const gchar *
clutter_shader_get_fragment_source (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
return clutter_shader_get_source (shader, CLUTTER_FRAGMENT_SHADER);
}
/**
* clutter_shader_get_vertex_source:
* @shader: a #ClutterShader
*
* Query the current GLSL vertex source set on @shader.
*
* Return value: the source of the vertex shader for this
* ClutterShader object or %NULL. The returned string is owned by the
* shader object and should never be modified or freed
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
const gchar *
clutter_shader_get_vertex_source (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
return clutter_shader_get_source (shader, CLUTTER_VERTEX_SHADER);
}
/**
* clutter_shader_get_cogl_program:
* @shader: a #ClutterShader
*
* Retrieves the underlying #CoglHandle for the shader program.
*
* Return value: (transfer none): A #CoglHandle for the shader program,
* or %NULL. The handle is owned by the #ClutterShader and it should
* not be unreferenced
*
* Since: 1.0
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
CoglHandle
clutter_shader_get_cogl_program (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
return shader->priv->program;
}
/**
* clutter_shader_get_cogl_fragment_shader:
* @shader: a #ClutterShader
*
* Retrieves the underlying #CoglHandle for the fragment shader.
*
* Return value: (transfer none): A #CoglHandle for the fragment
* shader, or %NULL. The handle is owned by the #ClutterShader
* and it should not be unreferenced
*
* Since: 1.0
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
CoglHandle
clutter_shader_get_cogl_fragment_shader (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
return clutter_shader_get_cogl_shader (shader, CLUTTER_FRAGMENT_SHADER);
}
/**
* clutter_shader_get_cogl_vertex_shader:
* @shader: a #ClutterShader
*
* Retrieves the underlying #CoglHandle for the vertex shader.
*
* Return value: (transfer none): A #CoglHandle for the vertex
* shader, or %NULL. The handle is owned by the #ClutterShader
* and it should not be unreferenced
*
* Since: 1.0
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead.
*/
CoglHandle
clutter_shader_get_cogl_vertex_shader (ClutterShader *shader)
{
g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
return clutter_shader_get_cogl_shader (shader, CLUTTER_VERTEX_SHADER);
}
GQuark
clutter_shader_error_quark (void)
{
return g_quark_from_static_string ("clutter-shader-error");
}

View File

@ -1,182 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Øyvind Kolås <pippin@o-hand.com>
*
* Copyright (C) 2007 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_SHADER_H__
#define __CLUTTER_SHADER_H__
#include <clutter/clutter-types.h>
#include <clutter/clutter-shader-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_SHADER (clutter_shader_get_type ())
#define CLUTTER_SHADER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CLUTTER_TYPE_SHADER, ClutterShader))
#define CLUTTER_SHADER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CLUTTER_TYPE_SHADER, ClutterShaderClass))
#define CLUTTER_IS_SHADER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CLUTTER_TYPE_SHADER))
#define CLUTTER_IS_SHADER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CLUTTER_TYPE_SHADER))
#define CLUTTER_SHADER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CLUTTER_TYPE_SHADER, ClutterShaderClass))
/**
* CLUTTER_SHADER_ERROR:
*
* Error domain for #ClutterShader errors
*
* Since: 0.6
*
* Deprecated: 1.8
*/
#define CLUTTER_SHADER_ERROR (clutter_shader_error_quark ())
/**
* ClutterShaderError:
* @CLUTTER_SHADER_ERROR_NO_ASM: No ASM shaders support
* @CLUTTER_SHADER_ERROR_NO_GLSL: No GLSL shaders support
* @CLUTTER_SHADER_ERROR_COMPILE: Compilation error
*
* #ClutterShader error enumeration
*
* Since: 0.6
*
* Deprecated: 1.8
*/
typedef enum {
CLUTTER_SHADER_ERROR_NO_ASM,
CLUTTER_SHADER_ERROR_NO_GLSL,
CLUTTER_SHADER_ERROR_COMPILE
} ClutterShaderError;
typedef struct _ClutterShaderPrivate ClutterShaderPrivate;
typedef struct _ClutterShaderClass ClutterShaderClass;
/**
* ClutterShader:
*
* The #ClutterShader structure contains only private data
* and should be accessed using the provided API
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffect instead
*/
struct _ClutterShader
{
/*< private >*/
GObject parent;
ClutterShaderPrivate *priv;
};
/**
* ClutterShaderClass:
*
* The #ClutterShaderClass structure contains only private data
*
* Since: 0.6
*
* Deprecated: 1.8: Use #ClutterShaderEffectClass instead
*/
struct _ClutterShaderClass
{
/*< private >*/
GObjectClass parent_class;
};
CLUTTER_DEPRECATED
GQuark clutter_shader_error_quark (void);
CLUTTER_DEPRECATED
GType clutter_shader_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
ClutterShader * clutter_shader_new (void);
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
void clutter_shader_set_is_enabled (ClutterShader *shader,
gboolean enabled);
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
gboolean clutter_shader_get_is_enabled (ClutterShader *shader);
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
gboolean clutter_shader_compile (ClutterShader *shader,
GError **error);
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
void clutter_shader_release (ClutterShader *shader);
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
gboolean clutter_shader_is_compiled (ClutterShader *shader);
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
void clutter_shader_set_vertex_source (ClutterShader *shader,
const gchar *data,
gssize length);
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
void clutter_shader_set_fragment_source (ClutterShader *shader,
const gchar *data,
gssize length);
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
const gchar * clutter_shader_get_vertex_source (ClutterShader *shader);
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
const gchar * clutter_shader_get_fragment_source (ClutterShader *shader);
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
void clutter_shader_set_uniform (ClutterShader *shader,
const gchar *name,
const GValue *value);
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
CoglHandle clutter_shader_get_cogl_program (ClutterShader *shader);
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
CoglHandle clutter_shader_get_cogl_fragment_shader (ClutterShader *shader);
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
CoglHandle clutter_shader_get_cogl_vertex_shader (ClutterShader *shader);
/* ClutterActor methods */
CLUTTER_DEPRECATED_FOR(clutter_actor_add_effect)
gboolean clutter_actor_set_shader (ClutterActor *self,
ClutterShader *shader);
CLUTTER_DEPRECATED_FOR(clutter_actor_get_effect)
ClutterShader * clutter_actor_get_shader (ClutterActor *self);
CLUTTER_DEPRECATED_FOR(clutter_shader_effect_set_uniform_value)
void clutter_actor_set_shader_param (ClutterActor *self,
const gchar *param,
const GValue *value);
CLUTTER_DEPRECATED_FOR(clutter_shader_effect_set_uniform)
void clutter_actor_set_shader_param_int (ClutterActor *self,
const gchar *param,
gint value);
CLUTTER_DEPRECATED_FOR(clutter_shader_effect_set_uniform)
void clutter_actor_set_shader_param_float (ClutterActor *self,
const gchar *param,
gfloat value);
G_END_DECLS
#endif /* __CLUTTER_SHADER_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,187 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Øyvind Kolås <pippin@linux.intel.com>
*
* Copyright (C) 2009 Intel Corporation
*
* 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_STATE_H__
#define __CLUTTER_STATE_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_STATE_KEY (clutter_state_key_get_type ())
#define CLUTTER_TYPE_STATE (clutter_state_get_type ())
#define CLUTTER_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STATE, ClutterState))
#define CLUTTER_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STATE, ClutterStateClass))
#define CLUTTER_IS_STATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STATE))
#define CLUTTER_IS_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STATE))
#define CLUTTER_STATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STATE, ClutterStateClass))
typedef struct _ClutterStatePrivate ClutterStatePrivate;
typedef struct _ClutterStateClass ClutterStateClass;
/**
* ClutterStateKey:
*
* #ClutterStateKey is an opaque structure whose
* members cannot be accessed directly
*
* Since: 1.4
*/
typedef struct _ClutterStateKey ClutterStateKey;
/**
* ClutterState:
*
* The #ClutterState structure contains only
* private data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _ClutterState
{
/*< private >*/
GObject parent;
ClutterStatePrivate *priv;
};
/**
* ClutterStateClass:
* @completed: class handler for the #ClutterState::completed signal
*
* The #ClutterStateClass structure contains
* only private data
*
* Since: 1.4
*
* Deprecated: 1.12
*/
struct _ClutterStateClass
{
/*< private >*/
GObjectClass parent_class;
/*< public >*/
void (* completed) (ClutterState *state);
/*< private >*/
/* padding for future expansion */
gpointer _padding_dummy[8];
};
CLUTTER_DEPRECATED
GType clutter_state_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
ClutterState *clutter_state_new (void);
CLUTTER_DEPRECATED
ClutterTimeline * clutter_state_set_state (ClutterState *state,
const gchar *target_state_name);
CLUTTER_DEPRECATED
ClutterTimeline * clutter_state_warp_to_state (ClutterState *state,
const gchar *target_state_name);
CLUTTER_DEPRECATED
ClutterState * clutter_state_set_key (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
GObject *object,
const gchar *property_name,
guint mode,
const GValue *value,
gdouble pre_delay,
gdouble post_delay);
CLUTTER_DEPRECATED
void clutter_state_set_duration (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
guint duration);
CLUTTER_DEPRECATED
guint clutter_state_get_duration (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name);
CLUTTER_DEPRECATED
void clutter_state_set (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
gpointer first_object,
const gchar *first_property_name,
gulong first_mode,
...) G_GNUC_NULL_TERMINATED;
CLUTTER_DEPRECATED
GList * clutter_state_get_states (ClutterState *state);
CLUTTER_DEPRECATED
GList * clutter_state_get_keys (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
GObject *object,
const gchar *property_name);
CLUTTER_DEPRECATED
void clutter_state_remove_key (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
GObject *object,
const gchar *property_name);
CLUTTER_DEPRECATED
ClutterTimeline * clutter_state_get_timeline (ClutterState *state);
CLUTTER_DEPRECATED
void clutter_state_set_animator (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
ClutterAnimator *animator);
CLUTTER_DEPRECATED
ClutterAnimator * clutter_state_get_animator (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name);
CLUTTER_DEPRECATED
const gchar * clutter_state_get_state (ClutterState *state);
/*
* ClutterStateKey
*/
CLUTTER_DEPRECATED
GType clutter_state_key_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
gdouble clutter_state_key_get_pre_delay (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED
gdouble clutter_state_key_get_post_delay (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED
gulong clutter_state_key_get_mode (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED
gboolean clutter_state_key_get_value (const ClutterStateKey *state_key,
GValue *value);
CLUTTER_DEPRECATED
GType clutter_state_key_get_property_type (const ClutterStateKey *key);
CLUTTER_DEPRECATED
GObject * clutter_state_key_get_object (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED
const gchar * clutter_state_key_get_property_name (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED
const gchar * clutter_state_key_get_source_state_name (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED
const gchar * clutter_state_key_get_target_state_name (const ClutterStateKey *state_key);
G_END_DECLS
#endif /* __CLUTTER_STATE_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,172 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2010 Intel Corporation.
*
* 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/>.
*
* Author:
* Jose Dapena Paz <jdapena@igalia.com>
*
* Based on the MX MxTable actor by:
* Thomas Wood <thomas.wood@intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_TABLE_LAYOUT_H__
#define __CLUTTER_TABLE_LAYOUT_H__
#include <clutter/clutter-layout-manager.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_TABLE_LAYOUT (clutter_table_layout_get_type ())
#define CLUTTER_TABLE_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TABLE_LAYOUT, ClutterTableLayout))
#define CLUTTER_IS_TABLE_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TABLE_LAYOUT))
#define CLUTTER_TABLE_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TABLE_LAYOUT, ClutterTableLayoutClass))
#define CLUTTER_IS_TABLE_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TABLE_LAYOUT))
#define CLUTTER_TABLE_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TABLE_LAYOUT, ClutterTableLayoutClass))
typedef struct _ClutterTableLayout ClutterTableLayout;
typedef struct _ClutterTableLayoutPrivate ClutterTableLayoutPrivate;
typedef struct _ClutterTableLayoutClass ClutterTableLayoutClass;
/**
* ClutterTableLayout:
*
* The #ClutterTableLayout structure contains only private data
* and should be accessed using the provided API
*
* Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/
struct _ClutterTableLayout
{
/*< private >*/
ClutterLayoutManager parent_instance;
ClutterTableLayoutPrivate *priv;
};
/**
* ClutterTableLayoutClass:
*
* The #ClutterTableLayoutClass structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/
struct _ClutterTableLayoutClass
{
/*< private >*/
ClutterLayoutManagerClass parent_class;
};
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_get_type)
GType clutter_table_layout_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_new)
ClutterLayoutManager *clutter_table_layout_new (void);
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_attach)
void clutter_table_layout_pack (ClutterTableLayout *layout,
ClutterActor *actor,
gint column,
gint row);
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_set_column_spacing)
void clutter_table_layout_set_column_spacing (ClutterTableLayout *layout,
guint spacing);
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_set_row_spacing)
void clutter_table_layout_set_row_spacing (ClutterTableLayout *layout,
guint spacing);
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_get_column_spacing)
guint clutter_table_layout_get_column_spacing (ClutterTableLayout *layout);
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_get_row_spacing)
guint clutter_table_layout_get_row_spacing (ClutterTableLayout *layout);
CLUTTER_DEPRECATED
void clutter_table_layout_set_span (ClutterTableLayout *layout,
ClutterActor *actor,
gint column_span,
gint row_span);
CLUTTER_DEPRECATED
void clutter_table_layout_get_span (ClutterTableLayout *layout,
ClutterActor *actor,
gint *column_span,
gint *row_span);
CLUTTER_DEPRECATED
void clutter_table_layout_set_alignment (ClutterTableLayout *layout,
ClutterActor *actor,
ClutterTableAlignment x_align,
ClutterTableAlignment y_align);
CLUTTER_DEPRECATED
void clutter_table_layout_get_alignment (ClutterTableLayout *layout,
ClutterActor *actor,
ClutterTableAlignment *x_align,
ClutterTableAlignment *y_align);
CLUTTER_DEPRECATED
void clutter_table_layout_set_fill (ClutterTableLayout *layout,
ClutterActor *actor,
gboolean x_fill,
gboolean y_fill);
CLUTTER_DEPRECATED
void clutter_table_layout_get_fill (ClutterTableLayout *layout,
ClutterActor *actor,
gboolean *x_fill,
gboolean *y_fill);
CLUTTER_DEPRECATED
void clutter_table_layout_set_expand (ClutterTableLayout *layout,
ClutterActor *actor,
gboolean x_expand,
gboolean y_expand);
CLUTTER_DEPRECATED
void clutter_table_layout_get_expand (ClutterTableLayout *layout,
ClutterActor *actor,
gboolean *x_expand,
gboolean *y_expand);
CLUTTER_DEPRECATED
gint clutter_table_layout_get_row_count (ClutterTableLayout *layout);
CLUTTER_DEPRECATED
gint clutter_table_layout_get_column_count (ClutterTableLayout *layout);
CLUTTER_DEPRECATED
void clutter_table_layout_set_use_animations (ClutterTableLayout *layout,
gboolean animate);
CLUTTER_DEPRECATED
gboolean clutter_table_layout_get_use_animations (ClutterTableLayout *layout);
CLUTTER_DEPRECATED
void clutter_table_layout_set_easing_mode (ClutterTableLayout *layout,
gulong mode);
CLUTTER_DEPRECATED
gulong clutter_table_layout_get_easing_mode (ClutterTableLayout *layout);
CLUTTER_DEPRECATED
void clutter_table_layout_set_easing_duration (ClutterTableLayout *layout,
guint msecs);
CLUTTER_DEPRECATED
guint clutter_table_layout_get_easing_duration (ClutterTableLayout *layout);
G_END_DECLS
#endif /* __CLUTTER_TABLE_LAYOUT_H__ */

View File

@ -45,9 +45,6 @@
#include "clutter-build-config.h"
/* sadly, we are still using ClutterShader internally */
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <cogl/cogl.h>
#include "clutter-texture.h"
@ -64,7 +61,6 @@
#include "clutter-stage-private.h"
#include "clutter-backend.h"
#include "deprecated/clutter-shader.h"
#include "deprecated/clutter-texture.h"
#include "deprecated/clutter-util.h"
@ -480,22 +476,10 @@ update_fbo (ClutterActor *self)
{
ClutterTexture *texture = CLUTTER_TEXTURE (self);
ClutterTexturePrivate *priv = texture->priv;
ClutterActor *head;
ClutterShader *shader = NULL;
ClutterActor *stage = NULL;
CoglMatrix projection;
CoglColor transparent_col;
head = _clutter_context_peek_shader_stack ();
if (head != NULL)
shader = clutter_actor_get_shader (head);
/* Temporarily turn off the shader on the top of the context's
* shader stack, to restore the GL pipeline to it's natural state.
*/
if (shader != NULL)
clutter_shader_set_is_enabled (shader, FALSE);
/* Redirect drawing to the fbo */
cogl_push_framebuffer (priv->fbo_handle);
@ -554,10 +538,6 @@ update_fbo (ClutterActor *self)
/* Restore drawing to the previous framebuffer */
cogl_pop_framebuffer ();
/* If there is a shader on top of the shader stack, turn it back on. */
if (shader != NULL)
clutter_shader_set_is_enabled (shader, TRUE);
}
static void

View File

@ -1,140 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Neil Roberts <neil@linux.intel.com>
*
* Copyright (C) 2009 Intel Corporation.
*
* 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/>.
*/
#include "clutter-build-config.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
/* This file contains the common code to check whether an interval has
expired used in clutter-frame-source and clutter-timeout-pool. */
#include "clutter-timeout-interval.h"
void
_clutter_timeout_interval_init (ClutterTimeoutInterval *interval,
guint fps)
{
#if GLIB_CHECK_VERSION (2, 27, 3)
interval->start_time = g_get_monotonic_time () / 1000;
#else
{
GTimeVal start_time;
g_get_current_time (&start_time);
interval->start_time = start_time.tv_sec * 1000
+ start_time.tv_usec / 1000;
}
#endif
interval->fps = fps;
interval->frame_count = 0;
}
static gint64
_clutter_timeout_interval_get_ticks (gint64 current_time,
ClutterTimeoutInterval *interval)
{
return MAX (current_time - interval->start_time, 0);
}
gboolean
_clutter_timeout_interval_prepare (gint64 current_time,
ClutterTimeoutInterval *interval,
gint *delay)
{
gint elapsed_time, new_frame_num;
elapsed_time = _clutter_timeout_interval_get_ticks (current_time, interval);
new_frame_num = elapsed_time * interval->fps / 1000;
/* If time has gone backwards or the time since the last frame is
greater than the two frames worth then reset the time and do a
frame now */
if (new_frame_num < interval->frame_count ||
new_frame_num - interval->frame_count > 2)
{
/* Get the frame time rounded up to the nearest ms */
guint frame_time = (1000 + interval->fps - 1) / interval->fps;
/* Reset the start time */
interval->start_time = current_time;
/* Move the start time as if one whole frame has elapsed */
interval->start_time -= frame_time;
interval->frame_count = 0;
if (delay)
*delay = 0;
return TRUE;
}
else if (new_frame_num > interval->frame_count)
{
if (delay)
*delay = 0;
return TRUE;
}
else
{
if (delay)
*delay = ((interval->frame_count + 1) * 1000 / interval->fps
- elapsed_time);
return FALSE;
}
}
gboolean
_clutter_timeout_interval_dispatch (ClutterTimeoutInterval *interval,
GSourceFunc callback,
gpointer user_data)
{
if ((* callback) (user_data))
{
interval->frame_count++;
return TRUE;
}
return FALSE;
}
gint
_clutter_timeout_interval_compare_expiration (const ClutterTimeoutInterval *a,
const ClutterTimeoutInterval *b)
{
guint a_delay = 1000 / a->fps;
guint b_delay = 1000 / b->fps;
gint64 b_difference;
gint comparison;
b_difference = a->start_time - b->start_time;
comparison = ((gint) ((a->frame_count + 1) * a_delay)
- (gint) ((b->frame_count + 1) * b_delay + b_difference));
return (comparison < 0 ? -1
: comparison > 0 ? 1
: 0);
}

View File

@ -1,58 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Neil Roberts <neil@linux.intel.com>
*
* Copyright (C) 2009 Intel Corporation.
*
* 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_TIMEOUT_INTERVAL_H__
#define __CLUTTER_TIMEOUT_INTERVAL_H__
#include <glib.h>
G_BEGIN_DECLS
typedef struct _ClutterTimeoutInterval ClutterTimeoutInterval;
struct _ClutterTimeoutInterval
{
/* milliseconds */
gint64 start_time;
guint frame_count;
guint fps;
};
void _clutter_timeout_interval_init (ClutterTimeoutInterval *interval,
guint fps);
gboolean _clutter_timeout_interval_prepare (gint64 current_time,
ClutterTimeoutInterval *interval,
gint *delay);
gboolean _clutter_timeout_interval_dispatch (ClutterTimeoutInterval *interval,
GSourceFunc callback,
gpointer user_data);
gint _clutter_timeout_interval_compare_expiration (const ClutterTimeoutInterval *a,
const ClutterTimeoutInterval *b);
G_END_DECLS
#endif /* __CLUTTER_TIMEOUT_INTERVAL_H__ */

View File

@ -1,498 +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/>.
*
*
*
* ClutterTimeoutPool: pool of timeout functions using the same slice of
* the GLib main loop
*
* Author: Emmanuele Bassi <ebassi@openedhand.com>
*
* Based on similar code by Tristan van Berkom
*/
#include "clutter-build-config.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-main.h"
#include "clutter-timeout-pool.h"
#include "clutter-debug.h"
#include "clutter-timeout-interval.h"
typedef struct _ClutterTimeout ClutterTimeout;
typedef enum {
CLUTTER_TIMEOUT_NONE = 0,
CLUTTER_TIMEOUT_READY = 1 << 1
} ClutterTimeoutFlags;
struct _ClutterTimeout
{
guint id;
ClutterTimeoutFlags flags;
gint refcount;
ClutterTimeoutInterval interval;
GSourceFunc func;
gpointer data;
GDestroyNotify notify;
};
struct _ClutterTimeoutPool
{
GSource source;
guint next_id;
GList *timeouts;
GList *dispatched_timeouts;
gint ready;
guint id;
};
#define TIMEOUT_READY(timeout) (timeout->flags & CLUTTER_TIMEOUT_READY)
static gboolean clutter_timeout_pool_prepare (GSource *source,
gint *next_timeout);
static gboolean clutter_timeout_pool_check (GSource *source);
static gboolean clutter_timeout_pool_dispatch (GSource *source,
GSourceFunc callback,
gpointer data);
static void clutter_timeout_pool_finalize (GSource *source);
static GSourceFuncs clutter_timeout_pool_funcs =
{
clutter_timeout_pool_prepare,
clutter_timeout_pool_check,
clutter_timeout_pool_dispatch,
clutter_timeout_pool_finalize
};
static gint
clutter_timeout_sort (gconstpointer a,
gconstpointer b)
{
const ClutterTimeout *t_a = a;
const ClutterTimeout *t_b = b;
/* Keep 'ready' timeouts at the front */
if (TIMEOUT_READY (t_a))
return -1;
if (TIMEOUT_READY (t_b))
return 1;
return _clutter_timeout_interval_compare_expiration (&t_a->interval,
&t_b->interval);
}
static gint
clutter_timeout_find_by_id (gconstpointer a,
gconstpointer b)
{
const ClutterTimeout *t_a = a;
return t_a->id == GPOINTER_TO_UINT (b) ? 0 : 1;
}
static ClutterTimeout *
clutter_timeout_new (guint fps)
{
ClutterTimeout *timeout;
timeout = g_slice_new0 (ClutterTimeout);
_clutter_timeout_interval_init (&timeout->interval, fps);
timeout->flags = CLUTTER_TIMEOUT_NONE;
timeout->refcount = 1;
return timeout;
}
static gboolean
clutter_timeout_prepare (ClutterTimeoutPool *pool,
ClutterTimeout *timeout,
gint *next_timeout)
{
GSource *source = (GSource *) pool;
gint64 now;
#if GLIB_CHECK_VERSION (2, 27, 3)
now = g_source_get_time (source) / 1000;
#else
{
GTimeVal source_time;
g_source_get_current_time (source, &source_time);
now = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
}
#endif
return _clutter_timeout_interval_prepare (now,
&timeout->interval,
next_timeout);
}
/* ref and unref are always called under the main Clutter lock, so there
* is not need for us to use g_atomic_int_* API.
*/
static ClutterTimeout *
clutter_timeout_ref (ClutterTimeout *timeout)
{
g_return_val_if_fail (timeout != NULL, timeout);
g_return_val_if_fail (timeout->refcount > 0, timeout);
timeout->refcount += 1;
return timeout;
}
static void
clutter_timeout_unref (ClutterTimeout *timeout)
{
g_return_if_fail (timeout != NULL);
g_return_if_fail (timeout->refcount > 0);
timeout->refcount -= 1;
if (timeout->refcount == 0)
{
if (timeout->notify)
timeout->notify (timeout->data);
g_slice_free (ClutterTimeout, timeout);
}
}
static void
clutter_timeout_free (ClutterTimeout *timeout)
{
if (G_LIKELY (timeout))
{
if (timeout->notify)
timeout->notify (timeout->data);
g_slice_free (ClutterTimeout, timeout);
}
}
static gboolean
clutter_timeout_pool_prepare (GSource *source,
gint *next_timeout)
{
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
GList *l = pool->timeouts;
/* the pool is ready if the first timeout is ready */
if (l && l->data)
{
ClutterTimeout *timeout = l->data;
return clutter_timeout_prepare (pool, timeout, next_timeout);
}
else
{
*next_timeout = -1;
return FALSE;
}
}
static gboolean
clutter_timeout_pool_check (GSource *source)
{
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
GList *l;
clutter_threads_enter ();
for (l = pool->timeouts; l; l = l->next)
{
ClutterTimeout *timeout = l->data;
/* since the timeouts are sorted by expiration, as soon
* as we get a check returning FALSE we know that the
* following timeouts are not expiring, so we break as
* soon as possible
*/
if (clutter_timeout_prepare (pool, timeout, NULL))
{
timeout->flags |= CLUTTER_TIMEOUT_READY;
pool->ready += 1;
}
else
break;
}
clutter_threads_leave ();
return (pool->ready > 0);
}
static gboolean
clutter_timeout_pool_dispatch (GSource *source,
GSourceFunc func,
gpointer data)
{
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
GList *dispatched_timeouts;
/* the main loop might have predicted this, so we repeat the
* check for ready timeouts.
*/
if (!pool->ready)
clutter_timeout_pool_check (source);
clutter_threads_enter ();
/* Iterate by moving the actual start of the list along so that it
* can cope with adds and removes while a timeout is being dispatched
*/
while (pool->timeouts && pool->timeouts->data && pool->ready-- > 0)
{
ClutterTimeout *timeout = pool->timeouts->data;
GList *l;
/* One of the ready timeouts may have been removed during dispatch,
* in which case pool->ready will be wrong, but the ready timeouts
* are always kept at the start of the list so we can stop once
* we've reached the first non-ready timeout
*/
if (!(TIMEOUT_READY (timeout)))
break;
/* Add a reference to the timeout so it can't disappear
* while it's being dispatched
*/
clutter_timeout_ref (timeout);
timeout->flags &= ~CLUTTER_TIMEOUT_READY;
/* Move the list node to a list of dispatched timeouts */
l = pool->timeouts;
if (l->next)
l->next->prev = NULL;
pool->timeouts = l->next;
if (pool->dispatched_timeouts)
pool->dispatched_timeouts->prev = l;
l->prev = NULL;
l->next = pool->dispatched_timeouts;
pool->dispatched_timeouts = l;
if (!_clutter_timeout_interval_dispatch (&timeout->interval,
timeout->func, timeout->data))
{
/* The timeout may have already been removed, but nothing
* can be added to the dispatched_timeout list except in this
* function so it will always either be at the head of the
* dispatched list or have been removed
*/
if (pool->dispatched_timeouts &&
pool->dispatched_timeouts->data == timeout)
{
pool->dispatched_timeouts =
g_list_delete_link (pool->dispatched_timeouts,
pool->dispatched_timeouts);
/* Remove the reference that was held by it being in the list */
clutter_timeout_unref (timeout);
}
}
clutter_timeout_unref (timeout);
}
/* Re-insert the dispatched timeouts in sorted order */
dispatched_timeouts = pool->dispatched_timeouts;
while (dispatched_timeouts)
{
ClutterTimeout *timeout = dispatched_timeouts->data;
GList *next = dispatched_timeouts->next;
if (timeout)
pool->timeouts = g_list_insert_sorted (pool->timeouts, timeout,
clutter_timeout_sort);
dispatched_timeouts = next;
}
g_list_free (pool->dispatched_timeouts);
pool->dispatched_timeouts = NULL;
pool->ready = 0;
clutter_threads_leave ();
return TRUE;
}
static void
clutter_timeout_pool_finalize (GSource *source)
{
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
/* force destruction */
g_list_foreach (pool->timeouts, (GFunc) clutter_timeout_free, NULL);
g_list_free (pool->timeouts);
}
/**
* clutter_timeout_pool_new:
* @priority: the priority of the timeout pool. Typically this will
* be #G_PRIORITY_DEFAULT
*
* Creates a new timeout pool source. A timeout pool should be used when
* multiple timeout functions, running at the same priority, are needed and
* the g_timeout_add() API might lead to starvation of the time slice of
* the main loop. A timeout pool allocates a single time slice of the main
* loop and runs every timeout function inside it. The timeout pool is
* always sorted, so that the extraction of the next timeout function is
* a constant time operation.
*
* Return value: the newly created #ClutterTimeoutPool. The created pool
* is owned by the GLib default context and will be automatically
* destroyed when the context is destroyed. It is possible to force
* the destruction of the timeout pool using g_source_destroy()
*
* Since: 0.4
*
* Deprecated: 1.6: There is no direct replacement for this API
*/
ClutterTimeoutPool *
clutter_timeout_pool_new (gint priority)
{
ClutterTimeoutPool *pool;
GSource *source;
source = g_source_new (&clutter_timeout_pool_funcs,
sizeof (ClutterTimeoutPool));
if (!source)
return NULL;
g_source_set_name (source, "Clutter timeout pool");
if (priority != G_PRIORITY_DEFAULT)
g_source_set_priority (source, priority);
pool = (ClutterTimeoutPool *) source;
pool->next_id = 1;
pool->id = g_source_attach (source, NULL);
/* let the default GLib context manage the pool */
g_source_unref (source);
return pool;
}
/**
* clutter_timeout_pool_add:
* @pool: a #ClutterTimeoutPool
* @fps: the time between calls to the function, in frames per second
* @func: function to call
* @data: (closure): data to pass to the function, or %NULL
* @notify: function to call when the timeout is removed, or %NULL
*
* Sets a function to be called at regular intervals, and puts it inside
* the @pool. The function is repeatedly called until it returns %FALSE,
* at which point the timeout is automatically destroyed and the function
* won't be called again. If @notify is not %NULL, the @notify function
* will be called. The first call to @func will be at the end of @interval.
*
* Since Clutter 0.8 this will try to compensate for delays. For
* example, if @func takes half the interval time to execute then the
* function will be called again half the interval time after it
* finished. Before version 0.8 it would not fire until a full
* interval after the function completes so the delay between calls
* would be @interval * 1.5. This function does not however try to
* invoke the function multiple times to catch up missing frames if
* @func takes more than @interval ms to execute.
*
* Return value: the ID (greater than 0) of the timeout inside the pool.
* Use clutter_timeout_pool_remove() to stop the timeout.
*
* Since: 0.4
*
* Deprecated: 1.6: There is no direct replacement for this API
*/
guint
clutter_timeout_pool_add (ClutterTimeoutPool *pool,
guint fps,
GSourceFunc func,
gpointer data,
GDestroyNotify notify)
{
ClutterTimeout *timeout;
guint retval = 0;
timeout = clutter_timeout_new (fps);
retval = timeout->id = pool->next_id++;
timeout->func = func;
timeout->data = data;
timeout->notify = notify;
pool->timeouts = g_list_insert_sorted (pool->timeouts, timeout,
clutter_timeout_sort);
return retval;
}
/**
* clutter_timeout_pool_remove:
* @pool: a #ClutterTimeoutPool
* @id_: the id of the timeout to remove
*
* Removes a timeout function with @id_ from the timeout pool. The id
* is the same returned when adding a function to the timeout pool with
* clutter_timeout_pool_add().
*
* Since: 0.4
*
* Deprecated: 1.6: There is no direct replacement for this API
*/
void
clutter_timeout_pool_remove (ClutterTimeoutPool *pool,
guint id_)
{
GList *l;
if ((l = g_list_find_custom (pool->timeouts, GUINT_TO_POINTER (id_),
clutter_timeout_find_by_id)))
{
clutter_timeout_unref (l->data);
pool->timeouts = g_list_delete_link (pool->timeouts, l);
}
else if ((l = g_list_find_custom (pool->dispatched_timeouts,
GUINT_TO_POINTER (id_),
clutter_timeout_find_by_id)))
{
clutter_timeout_unref (l->data);
pool->dispatched_timeouts =
g_list_delete_link (pool->dispatched_timeouts, l);
}
}

View File

@ -1,69 +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/>.
*
* ClutterTimeoutPool: pool of timeout functions using the same slice of
* the GLib main loop
*
* Author: Emmanuele Bassi <ebassi@openedhand.com>
*
* Based on similar code by Tristan van Berkom
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_TIMEOUT_POOL_H__
#define __CLUTTER_TIMEOUT_POOL_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
/**
* ClutterTimeoutPool: (skip)
*
* #ClutterTimeoutPool is an opaque structure
* whose members cannot be directly accessed.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
typedef struct _ClutterTimeoutPool ClutterTimeoutPool;
CLUTTER_DEPRECATED
ClutterTimeoutPool *clutter_timeout_pool_new (gint priority);
CLUTTER_DEPRECATED
guint clutter_timeout_pool_add (ClutterTimeoutPool *pool,
guint fps,
GSourceFunc func,
gpointer data,
GDestroyNotify notify);
CLUTTER_DEPRECATED
void clutter_timeout_pool_remove (ClutterTimeoutPool *pool,
guint id_);
G_END_DECLS
#endif /* __CLUTTER_TIMEOUT_POOL_H__ */

View File

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

View File

@ -40,7 +40,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',
@ -218,7 +217,6 @@ clutter_deprecated_headers = [
'deprecated/clutter-alpha.h',
'deprecated/clutter-animatable.h',
'deprecated/clutter-animation.h',
'deprecated/clutter-animator.h',
'deprecated/clutter-backend.h',
'deprecated/clutter-behaviour.h',
'deprecated/clutter-behaviour-depth.h',
@ -228,27 +226,16 @@ clutter_deprecated_headers = [
'deprecated/clutter-behaviour-rotate.h',
'deprecated/clutter-behaviour-scale.h',
'deprecated/clutter-bin-layout.h',
'deprecated/clutter-box.h',
'deprecated/clutter-cairo-texture.h',
'deprecated/clutter-container.h',
'deprecated/clutter-frame-source.h',
'deprecated/clutter-group.h',
'deprecated/clutter-input-device.h',
'deprecated/clutter-keysyms.h',
'deprecated/clutter-list-model.h',
'deprecated/clutter-main.h',
'deprecated/clutter-media.h',
'deprecated/clutter-model.h',
'deprecated/clutter-rectangle.h',
'deprecated/clutter-score.h',
'deprecated/clutter-shader.h',
'deprecated/clutter-stage-manager.h',
'deprecated/clutter-stage.h',
'deprecated/clutter-state.h',
'deprecated/clutter-table-layout.h',
'deprecated/clutter-texture.h',
'deprecated/clutter-timeline.h',
'deprecated/clutter-timeout-pool.h',
'deprecated/clutter-util.h',
]
@ -256,7 +243,6 @@ clutter_deprecated_sources = [
'deprecated/clutter-actor-deprecated.c',
'deprecated/clutter-alpha.c',
'deprecated/clutter-animation.c',
'deprecated/clutter-animator.c',
'deprecated/clutter-behaviour.c',
'deprecated/clutter-behaviour-depth.c',
'deprecated/clutter-behaviour-ellipse.c',
@ -264,31 +250,11 @@ clutter_deprecated_sources = [
'deprecated/clutter-behaviour-path.c',
'deprecated/clutter-behaviour-rotate.c',
'deprecated/clutter-behaviour-scale.c',
'deprecated/clutter-box.c',
'deprecated/clutter-cairo-texture.c',
'deprecated/clutter-frame-source.c',
'deprecated/clutter-group.c',
'deprecated/clutter-input-device-deprecated.c',
'deprecated/clutter-layout-manager-deprecated.c',
'deprecated/clutter-list-model.c',
'deprecated/clutter-media.c',
'deprecated/clutter-model.c',
'deprecated/clutter-rectangle.c',
'deprecated/clutter-score.c',
'deprecated/clutter-shader.c',
'deprecated/clutter-state.c',
'deprecated/clutter-table-layout.c',
'deprecated/clutter-texture.c',
'deprecated/clutter-timeout-pool.c',
]
clutter_deprecated_private_headers = [
'deprecated/clutter-model-private.h',
'deprecated/clutter-timeout-interval.h',
]
clutter_deprecated_nonintrospected_sources = [
'deprecated/clutter-timeout-interval.c',
]
clutter_backend_sources = []
@ -393,7 +359,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',
@ -408,7 +373,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',
@ -508,9 +472,7 @@ libmutter_clutter = shared_library(libmutter_clutter_name,
clutter_private_headers,
clutter_nonintrospected_sources,
clutter_deprecated_sources,
clutter_deprecated_nonintrospected_sources,
clutter_deprecated_headers,
clutter_deprecated_private_headers,
clutter_backend_sources,
clutter_backend_nonintrospected_sources,
clutter_backend_headers,

View File

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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -43,14 +43,12 @@ general_tests = \
binding-pool \
color \
interval \
model \
script-parser \
units \
$(NULL)
# Test for deprecated functionality
deprecated_tests = \
animator \
behaviours \
group \
rectangle \
@ -62,9 +60,6 @@ test_programs = $(actor_tests) $(general_tests) $(classes_tests) $(deprecated_te
dist_test_data = $(script_ui_files)
script_ui_files = $(addprefix scripts/,$(script_tests))
script_tests = \
test-animator-1.json \
test-animator-2.json \
test-animator-3.json \
test-script-animation.json \
test-script-child.json \
test-script-implicit-alpha.json \
@ -75,8 +70,7 @@ script_tests = \
test-script-named-object.json \
test-script-object-property.json \
test-script-single.json \
test-script-timeline-markers.json \
test-state-1.json
test-script-timeline-markers.json
TESTS_ENVIRONMENT += G_ENABLE_DIAGNOSTIC=0 CLUTTER_ENABLE_DIAGNOSTIC=0 CLUTTER_SCALE=1

View File

@ -82,7 +82,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);
@ -109,7 +109,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);

View File

@ -1,199 +0,0 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h>
static void
animator_multi_properties (void)
{
ClutterScript *script = clutter_script_new ();
GObject *animator = NULL, *foo = NULL;
GError *error = NULL;
gchar *test_file;
GList *keys;
ClutterAnimatorKey *key;
GValue value = { 0, };
test_file = g_test_build_filename (G_TEST_DIST,
"scripts",
"test-animator-3.json",
NULL);
clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error)
g_print ("Error: %s", error->message);
g_assert_no_error (error);
foo = clutter_script_get_object (script, "foo");
g_assert (G_IS_OBJECT (foo));
animator = clutter_script_get_object (script, "animator");
g_assert (CLUTTER_IS_ANIMATOR (animator));
/* get all the keys for foo:x */
keys = clutter_animator_get_keys (CLUTTER_ANIMATOR (animator),
foo, "x",
-1.0);
g_assert_cmpint (g_list_length (keys), ==, 3);
key = g_list_nth_data (keys, 1);
g_assert (key != NULL);
if (g_test_verbose ())
{
g_print ("(foo, x).keys[1] = \n"
".object = %s\n"
".progress = %.2f\n"
".name = '%s'\n"
".type = '%s'\n",
clutter_get_script_id (clutter_animator_key_get_object (key)),
clutter_animator_key_get_progress (key),
clutter_animator_key_get_property_name (key),
g_type_name (clutter_animator_key_get_property_type (key)));
}
g_assert (clutter_animator_key_get_object (key) != NULL);
g_assert_cmpfloat (clutter_animator_key_get_progress (key), ==, 0.2);
g_assert_cmpstr (clutter_animator_key_get_property_name (key), ==, "x");
g_assert (clutter_animator_key_get_property_type (key) == G_TYPE_FLOAT);
g_value_init (&value, G_TYPE_FLOAT);
g_assert (clutter_animator_key_get_value (key, &value));
g_assert_cmpfloat (g_value_get_float (&value), ==, 150.0);
g_value_unset (&value);
g_list_free (keys);
/* get all the keys for foo:y */
keys = clutter_animator_get_keys (CLUTTER_ANIMATOR (animator),
foo, "y",
-1.0);
g_assert_cmpint (g_list_length (keys), ==, 3);
key = g_list_nth_data (keys, 2);
g_assert (key != NULL);
if (g_test_verbose ())
{
g_print ("(foo, y).keys[2] = \n"
".object = %s\n"
".progress = %.2f\n"
".name = '%s'\n"
".type = '%s'\n",
clutter_get_script_id (clutter_animator_key_get_object (key)),
clutter_animator_key_get_progress (key),
clutter_animator_key_get_property_name (key),
g_type_name (clutter_animator_key_get_property_type (key)));
}
g_assert (clutter_animator_key_get_object (key) != NULL);
g_assert_cmpfloat (clutter_animator_key_get_progress (key), ==, 0.8);
g_assert_cmpstr (clutter_animator_key_get_property_name (key), ==, "y");
g_assert (clutter_animator_key_get_property_type (key) == G_TYPE_FLOAT);
g_value_init (&value, G_TYPE_FLOAT);
g_assert (clutter_animator_key_get_value (key, &value));
g_assert_cmpfloat (g_value_get_float (&value), ==, 200.0);
g_value_unset (&value);
g_list_free (keys);
g_object_unref (script);
g_free (test_file);
}
static void
animator_properties (void)
{
ClutterScript *script = clutter_script_new ();
GObject *animator = NULL;
GError *error = NULL;
gchar *test_file;
GList *keys;
ClutterAnimatorKey *key;
GValue value = { 0, };
test_file = g_test_build_filename (G_TEST_DIST,
"scripts",
"test-animator-2.json",
NULL);
clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error)
g_print ("Error: %s", error->message);
g_assert_no_error (error);
animator = clutter_script_get_object (script, "animator");
g_assert (CLUTTER_IS_ANIMATOR (animator));
/* get all the keys */
keys = clutter_animator_get_keys (CLUTTER_ANIMATOR (animator),
NULL, NULL, -1.0);
g_assert_cmpint (g_list_length (keys), ==, 3);
key = g_list_nth_data (keys, 1);
g_assert (key != NULL);
if (g_test_verbose ())
{
g_print ("keys[1] = \n"
".object = %s\n"
".progress = %.2f\n"
".name = '%s'\n"
".type = '%s'\n",
clutter_get_script_id (clutter_animator_key_get_object (key)),
clutter_animator_key_get_progress (key),
clutter_animator_key_get_property_name (key),
g_type_name (clutter_animator_key_get_property_type (key)));
}
g_assert (clutter_animator_key_get_object (key) != NULL);
g_assert_cmpfloat (clutter_animator_key_get_progress (key), ==, 0.2);
g_assert_cmpstr (clutter_animator_key_get_property_name (key), ==, "x");
g_assert (clutter_animator_key_get_property_type (key) == G_TYPE_FLOAT);
g_value_init (&value, G_TYPE_FLOAT);
g_assert (clutter_animator_key_get_value (key, &value));
g_assert_cmpfloat (g_value_get_float (&value), ==, 150.0);
g_value_unset (&value);
g_list_free (keys);
g_object_unref (script);
g_free (test_file);
}
static void
animator_base (void)
{
ClutterScript *script = clutter_script_new ();
GObject *animator = NULL;
GError *error = NULL;
guint duration = 0;
gchar *test_file;
test_file = g_test_build_filename (G_TEST_DIST,
"scripts",
"test-animator-1.json",
NULL);
clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error)
g_print ("Error: %s", error->message);
g_assert_no_error (error);
animator = clutter_script_get_object (script, "animator");
g_assert (CLUTTER_IS_ANIMATOR (animator));
duration = clutter_animator_get_duration (CLUTTER_ANIMATOR (animator));
g_assert_cmpint (duration, ==, 1000);
g_object_unref (script);
g_free (test_file);
}
CLUTTER_TEST_SUITE (
CLUTTER_TEST_UNIT ("/script/animator/base", animator_base)
CLUTTER_TEST_UNIT ("/script/animator/properties", animator_properties)
CLUTTER_TEST_UNIT ("/script/animator/multi-properties", animator_multi_properties)
)

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

@ -35,15 +35,12 @@ clutter_conform_tests_general_tests = [
'binding-pool',
'color',
'interval',
'model',
'script-parser',
'units',
]
clutter_conform_tests_deprecated_tests = [
'animator',
'behaviours',
'group',
'rectangle',
'texture',
]

View File

@ -1,528 +0,0 @@
#include <stdlib.h>
#include <string.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h>
typedef struct _ModelData
{
ClutterModel *model;
guint n_row;
} ModelData;
typedef struct _ChangedData
{
ClutterModel *model;
ClutterModelIter *iter;
guint row;
guint n_emissions;
gint value_check;
} ChangedData;
enum
{
COLUMN_FOO, /* G_TYPE_STRING */
COLUMN_BAR, /* G_TYPE_INT */
N_COLUMNS
};
static const struct {
const gchar *expected_foo;
gint expected_bar;
} base_model[] = {
{ "String 1", 1 },
{ "String 2", 2 },
{ "String 3", 3 },
{ "String 4", 4 },
{ "String 5", 5 },
{ "String 6", 6 },
{ "String 7", 7 },
{ "String 8", 8 },
{ "String 9", 9 },
};
static const struct {
const gchar *expected_foo;
gint expected_bar;
} forward_base[] = {
{ "String 1", 1 },
{ "String 2", 2 },
{ "String 3", 3 },
{ "String 4", 4 },
{ "String 5", 5 },
{ "String 6", 6 },
{ "String 7", 7 },
{ "String 8", 8 },
{ "String 9", 9 },
};
static const struct {
const gchar *expected_foo;
gint expected_bar;
} backward_base[] = {
{ "String 9", 9 },
{ "String 8", 8 },
{ "String 7", 7 },
{ "String 6", 6 },
{ "String 5", 5 },
{ "String 4", 4 },
{ "String 3", 3 },
{ "String 2", 2 },
{ "String 1", 1 },
};
static const struct {
const gchar *expected_foo;
gint expected_bar;
} filter_odd[] = {
{ "String 1", 1 },
{ "String 3", 3 },
{ "String 5", 5 },
{ "String 7", 7 },
{ "String 9", 9 },
};
static const struct {
const gchar *expected_foo;
gint expected_bar;
} filter_even[] = {
{ "String 8", 8 },
{ "String 6", 6 },
{ "String 4", 4 },
{ "String 2", 2 },
};
static inline void
compare_iter (ClutterModelIter *iter,
const gint expected_row,
const gchar *expected_foo,
const gint expected_bar)
{
gchar *foo = NULL;
gint bar = 0;
gint row = 0;
row = clutter_model_iter_get_row (iter);
clutter_model_iter_get (iter,
COLUMN_FOO, &foo,
COLUMN_BAR, &bar,
-1);
if (g_test_verbose ())
g_print ("Row %d => %d: Got [ '%s', '%d' ], expected [ '%s', '%d' ]\n",
row, expected_row,
foo, bar,
expected_foo, expected_bar);
g_assert_cmpint (row, ==, expected_row);
g_assert_cmpstr (foo, ==, expected_foo);
g_assert_cmpint (bar, ==, expected_bar);
g_free (foo);
}
static void
on_row_added (ClutterModel *model,
ClutterModelIter *iter,
gpointer data)
{
ModelData *model_data = data;
compare_iter (iter,
model_data->n_row,
base_model[model_data->n_row].expected_foo,
base_model[model_data->n_row].expected_bar);
model_data->n_row += 1;
}
static gboolean
filter_even_rows (ClutterModel *model,
ClutterModelIter *iter,
gpointer dummy G_GNUC_UNUSED)
{
gint bar_value;
clutter_model_iter_get (iter, COLUMN_BAR, &bar_value, -1);
if (bar_value % 2 == 0)
return TRUE;
return FALSE;
}
static gboolean
filter_odd_rows (ClutterModel *model,
ClutterModelIter *iter,
gpointer dummy G_GNUC_UNUSED)
{
gint bar_value;
clutter_model_iter_get (iter, COLUMN_BAR, &bar_value, -1);
if (bar_value % 2 != 0)
return TRUE;
return FALSE;
}
static void
list_model_filter (void)
{
ModelData test_data = { NULL, 0 };
ClutterModelIter *iter;
gint i;
test_data.model = clutter_list_model_new (N_COLUMNS,
G_TYPE_STRING, "Foo",
G_TYPE_INT, "Bar");
test_data.n_row = 0;
for (i = 1; i < 10; i++)
{
gchar *foo = g_strdup_printf ("String %d", i);
clutter_model_append (test_data.model,
COLUMN_FOO, foo,
COLUMN_BAR, i,
-1);
g_free (foo);
}
if (g_test_verbose ())
g_print ("Forward iteration (filter odd)...\n");
clutter_model_set_filter (test_data.model, filter_odd_rows, NULL, NULL);
iter = clutter_model_get_first_iter (test_data.model);
g_assert (iter != NULL);
i = 0;
while (!clutter_model_iter_is_last (iter))
{
compare_iter (iter, i,
filter_odd[i].expected_foo,
filter_odd[i].expected_bar);
iter = clutter_model_iter_next (iter);
i += 1;
}
g_object_unref (iter);
if (g_test_verbose ())
g_print ("Backward iteration (filter even)...\n");
clutter_model_set_filter (test_data.model, filter_even_rows, NULL, NULL);
iter = clutter_model_get_last_iter (test_data.model);
g_assert (iter != NULL);
i = 0;
do
{
compare_iter (iter, G_N_ELEMENTS (filter_even) - i - 1,
filter_even[i].expected_foo,
filter_even[i].expected_bar);
iter = clutter_model_iter_prev (iter);
i += 1;
}
while (!clutter_model_iter_is_first (iter));
g_object_unref (iter);
if (g_test_verbose ())
g_print ("get_iter_at_row...\n");
clutter_model_set_filter (test_data.model, filter_odd_rows, NULL, NULL);
for (i = 0; i < 5; i++)
{
iter = clutter_model_get_iter_at_row (test_data.model, i);
compare_iter (iter, i ,
filter_odd[i].expected_foo,
filter_odd[i].expected_bar);
g_object_unref (iter);
}
iter = clutter_model_get_iter_at_row (test_data.model, 5);
g_assert (iter == NULL);
g_object_unref (test_data.model);
}
static void
list_model_iterate (void)
{
ModelData test_data = { NULL, 0 };
ClutterModelIter *iter;
gint i;
test_data.model = clutter_list_model_new (N_COLUMNS,
G_TYPE_STRING, "Foo",
G_TYPE_INT, "Bar");
test_data.n_row = 0;
g_signal_connect (test_data.model, "row-added",
G_CALLBACK (on_row_added),
&test_data);
for (i = 1; i < 10; i++)
{
gchar *foo = g_strdup_printf ("String %d", i);
clutter_model_append (test_data.model,
COLUMN_FOO, foo,
COLUMN_BAR, i,
-1);
g_free (foo);
}
if (g_test_verbose ())
g_print ("Forward iteration...\n");
iter = clutter_model_get_first_iter (test_data.model);
g_assert (iter != NULL);
i = 0;
while (!clutter_model_iter_is_last (iter))
{
compare_iter (iter, i,
forward_base[i].expected_foo,
forward_base[i].expected_bar);
iter = clutter_model_iter_next (iter);
i += 1;
}
g_object_unref (iter);
if (g_test_verbose ())
g_print ("Backward iteration...\n");
iter = clutter_model_get_last_iter (test_data.model);
g_assert (iter != NULL);
i = 0;
do
{
compare_iter (iter, G_N_ELEMENTS (backward_base) - i - 1,
backward_base[i].expected_foo,
backward_base[i].expected_bar);
iter = clutter_model_iter_prev (iter);
i += 1;
}
while (!clutter_model_iter_is_first (iter));
compare_iter (iter, G_N_ELEMENTS (backward_base) - i - 1,
backward_base[i].expected_foo,
backward_base[i].expected_bar);
g_object_unref (iter);
g_object_unref (test_data.model);
}
static void
list_model_populate (void)
{
ModelData test_data = { NULL, 0 };
gint i;
test_data.model = clutter_list_model_new (N_COLUMNS,
G_TYPE_STRING, "Foo",
G_TYPE_INT, "Bar");
test_data.n_row = 0;
g_signal_connect (test_data.model, "row-added",
G_CALLBACK (on_row_added),
&test_data);
for (i = 1; i < 10; i++)
{
gchar *foo = g_strdup_printf ("String %d", i);
clutter_model_append (test_data.model,
COLUMN_FOO, foo,
COLUMN_BAR, i,
-1);
g_free (foo);
}
g_object_unref (test_data.model);
}
static void
list_model_from_script (void)
{
ClutterScript *script = clutter_script_new ();
GObject *model;
GError *error = NULL;
gchar *test_file;
const gchar *name;
GType type;
ClutterModelIter *iter;
GValue value = { 0, };
test_file = g_test_build_filename (G_TEST_DIST, "scripts", "test-script-model.json", NULL);
clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error)
g_print ("Error: %s", error->message);
g_assert_no_error (error);
model = clutter_script_get_object (script, "test-model");
g_assert (CLUTTER_IS_MODEL (model));
g_assert (clutter_model_get_n_columns (CLUTTER_MODEL (model)) == 3);
name = clutter_model_get_column_name (CLUTTER_MODEL (model), 0);
type = clutter_model_get_column_type (CLUTTER_MODEL (model), 0);
if (g_test_verbose ())
g_print ("column[0]: %s, type: %s\n", name, g_type_name (type));
g_assert (strcmp (name, "text-column") == 0);
g_assert (type == G_TYPE_STRING);
name = clutter_model_get_column_name (CLUTTER_MODEL (model), 2);
type = clutter_model_get_column_type (CLUTTER_MODEL (model), 2);
if (g_test_verbose ())
g_print ("column[2]: %s, type: %s\n", name, g_type_name (type));
g_assert (strcmp (name, "actor-column") == 0);
g_assert (g_type_is_a (type, CLUTTER_TYPE_ACTOR));
g_assert (clutter_model_get_n_rows (CLUTTER_MODEL (model)) == 3);
iter = clutter_model_get_iter_at_row (CLUTTER_MODEL (model), 0);
clutter_model_iter_get_value (iter, 0, &value);
g_assert (G_VALUE_HOLDS_STRING (&value));
g_assert (strcmp (g_value_get_string (&value), "text-row-1") == 0);
g_value_unset (&value);
clutter_model_iter_get_value (iter, 1, &value);
g_assert (G_VALUE_HOLDS_INT (&value));
g_assert (g_value_get_int (&value) == 1);
g_value_unset (&value);
clutter_model_iter_get_value (iter, 2, &value);
g_assert (G_VALUE_HOLDS_OBJECT (&value));
g_assert (g_value_get_object (&value) == NULL);
g_value_unset (&value);
iter = clutter_model_iter_next (iter);
clutter_model_iter_get_value (iter, 2, &value);
g_assert (G_VALUE_HOLDS_OBJECT (&value));
g_assert (CLUTTER_IS_ACTOR (g_value_get_object (&value)));
g_value_unset (&value);
iter = clutter_model_iter_next (iter);
clutter_model_iter_get_value (iter, 2, &value);
g_assert (G_VALUE_HOLDS_OBJECT (&value));
g_assert (CLUTTER_IS_ACTOR (g_value_get_object (&value)));
g_assert (strcmp (clutter_actor_get_name (g_value_get_object (&value)),
"actor-row-3") == 0);
g_value_unset (&value);
g_object_unref (iter);
}
static void
on_row_changed (ClutterModel *model,
ClutterModelIter *iter,
ChangedData *data)
{
gint value = -1;
clutter_model_iter_get (iter, COLUMN_BAR, &value, -1);
if (g_test_verbose ())
g_print ("row-changed value-check: %d, expected: %d\n",
value, data->value_check);
g_assert_cmpint (value, ==, data->value_check);
data->n_emissions += 1;
}
static void
list_model_row_changed (void)
{
ChangedData test_data = { NULL, NULL, 0, 0 };
GValue value = { 0, };
gint i;
test_data.model = clutter_list_model_new (N_COLUMNS,
G_TYPE_STRING, "Foo",
G_TYPE_INT, "Bar");
for (i = 1; i < 10; i++)
{
gchar *foo = g_strdup_printf ("String %d", i);
clutter_model_append (test_data.model,
COLUMN_FOO, foo,
COLUMN_BAR, i,
-1);
g_free (foo);
}
g_signal_connect (test_data.model, "row-changed",
G_CALLBACK (on_row_changed),
&test_data);
test_data.row = g_random_int_range (0, 9);
test_data.iter = clutter_model_get_iter_at_row (test_data.model,
test_data.row);
g_assert (CLUTTER_IS_MODEL_ITER (test_data.iter));
test_data.value_check = 47;
g_value_init (&value, G_TYPE_INT);
g_value_set_int (&value, test_data.value_check);
clutter_model_iter_set_value (test_data.iter, COLUMN_BAR, &value);
g_value_unset (&value);
if (g_test_verbose ())
g_print ("iter.set_value() emissions: %d, expected: 1\n",
test_data.n_emissions);
g_assert_cmpint (test_data.n_emissions, ==, 1);
test_data.n_emissions = 0;
test_data.value_check = 42;
clutter_model_iter_set (test_data.iter,
COLUMN_FOO, "changed",
COLUMN_BAR, test_data.value_check,
-1);
if (g_test_verbose ())
g_print ("iter.set() emissions: %d, expected: 1\n",
test_data.n_emissions);
g_assert_cmpint (test_data.n_emissions, ==, 1);
g_object_unref (test_data.iter);
g_object_unref (test_data.model);
}
CLUTTER_TEST_SUITE (
CLUTTER_TEST_UNIT ("/list-model/populate", list_model_populate)
CLUTTER_TEST_UNIT ("/list-model/iterate", list_model_iterate)
CLUTTER_TEST_UNIT ("/list-model/filter", list_model_filter)
CLUTTER_TEST_UNIT ("/list-model/row-changed", list_model_row_changed)
CLUTTER_TEST_UNIT ("/list-model/from-script", list_model_from_script)
)

View File

@ -1,121 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <clutter/clutter.h>
#include "test-conform-common.h"
static guint level = 0;
static void
on_score_started (ClutterScore *score)
{
if (g_test_verbose ())
g_print ("Score started\n");
}
static void
on_score_completed (ClutterScore *score)
{
if (g_test_verbose ())
g_print ("Score completed\n");
}
static void
on_timeline_started (ClutterScore *score,
ClutterTimeline *timeline)
{
if (g_test_verbose ())
g_print ("Started timeline: '%s'\n",
(gchar *) g_object_get_data (G_OBJECT (timeline), "timeline-name"));
level += 1;
}
static void
on_timeline_completed (ClutterScore *score,
ClutterTimeline *timeline)
{
if (g_test_verbose ())
g_print ("Completed timeline: '%s'\n",
(gchar *) g_object_get_data (G_OBJECT (timeline), "timeline-name"));
level -= 1;
}
void
score_base (TestConformSimpleFixture *fixture,
gconstpointer data)
{
ClutterScore *score;
ClutterTimeline *timeline_1;
ClutterTimeline *timeline_2;
ClutterTimeline *timeline_3;
ClutterTimeline *timeline_4;
ClutterTimeline *timeline_5;
GSList *timelines;
/* FIXME - this is necessary to make the master clock spin */
ClutterActor *stage = clutter_stage_new ();
timeline_1 = clutter_timeline_new (100);
g_object_set_data_full (G_OBJECT (timeline_1),
"timeline-name", g_strdup ("Timeline 1"),
g_free);
timeline_2 = clutter_timeline_new (100);
clutter_timeline_add_marker_at_time (timeline_2, "foo", 50);
g_object_set_data_full (G_OBJECT (timeline_2),
"timeline-name", g_strdup ("Timeline 2"),
g_free);
timeline_3 = clutter_timeline_new (100);
g_object_set_data_full (G_OBJECT (timeline_3),
"timeline-name", g_strdup ("Timeline 3"),
g_free);
timeline_4 = clutter_timeline_new (100);
g_object_set_data_full (G_OBJECT (timeline_4),
"timeline-name", g_strdup ("Timeline 4"),
g_free);
timeline_5 = clutter_timeline_new (100);
g_object_set_data_full (G_OBJECT (timeline_5),
"timeline-name", g_strdup ("Timeline 5"),
g_free);
score = clutter_score_new();
g_signal_connect (score, "started",
G_CALLBACK (on_score_started),
NULL);
g_signal_connect (score, "timeline-started",
G_CALLBACK (on_timeline_started),
NULL);
g_signal_connect (score, "timeline-completed",
G_CALLBACK (on_timeline_completed),
NULL);
g_signal_connect (score, "completed",
G_CALLBACK (on_score_completed),
NULL);
clutter_score_append (score, NULL, timeline_1);
clutter_score_append (score, timeline_1, timeline_2);
clutter_score_append (score, timeline_1, timeline_3);
clutter_score_append (score, timeline_3, timeline_4);
clutter_score_append_at_marker (score, timeline_2, "foo", timeline_5);
timelines = clutter_score_list_timelines (score);
g_assert (5 == g_slist_length (timelines));
g_slist_free (timelines);
clutter_score_start (score);
clutter_actor_destroy (stage);
g_object_unref (timeline_1);
g_object_unref (timeline_2);
g_object_unref (timeline_3);
g_object_unref (timeline_4);
g_object_unref (timeline_5);
g_object_unref (score);
}

View File

@ -251,10 +251,10 @@ script_object_property (void)
g_assert_no_error (error);
actor = clutter_script_get_object (script, "test");
g_assert (CLUTTER_IS_BOX (actor));
g_assert (CLUTTER_IS_ACTOR (actor));
manager = clutter_box_get_layout_manager (CLUTTER_BOX (actor));
g_assert (CLUTTER_IS_BIN_LAYOUT (manager));
manager = clutter_actor_get_layout_manager (CLUTTER_ACTOR (actor));
g_assert (CLUTTER_IS_BOX_LAYOUT (manager));
g_object_unref (script);
g_free (test_file);
@ -277,11 +277,14 @@ script_named_object (void)
g_assert_no_error (error);
actor = clutter_script_get_object (script, "test");
g_assert (CLUTTER_IS_BOX (actor));
g_assert (CLUTTER_IS_ACTOR (actor));
manager = clutter_box_get_layout_manager (CLUTTER_BOX (actor));
g_assert (CLUTTER_IS_BOX_LAYOUT (manager));
g_assert (clutter_box_layout_get_vertical (CLUTTER_BOX_LAYOUT (manager)));
manager = clutter_actor_get_layout_manager (CLUTTER_ACTOR (actor));
g_assert (CLUTTER_IS_GRID_LAYOUT (manager));
g_assert_cmpuint (clutter_grid_layout_get_row_spacing (CLUTTER_GRID_LAYOUT (manager)),
==, 6);
g_assert_cmpuint (clutter_grid_layout_get_column_spacing (CLUTTER_GRID_LAYOUT (manager)),
==, 12);
g_object_unref (script);
g_free (test_file);

View File

@ -1,5 +0,0 @@
{
"type" : "ClutterAnimator",
"id" : "animator",
"duration" : 1000
}

View File

@ -1,29 +0,0 @@
[
{
"type" : "ClutterRectangle",
"id" : "foo",
"x" : 0,
"y" : 0,
"width" : 100,
"height" : 100
},
{
"type" : "ClutterAnimator",
"id" : "animator",
"duration" : 1000,
"properties" : [
{
"object" : "foo",
"name" : "x",
"ease-in" : true,
"interpolation" : "linear",
"keys" : [
[ 0.0, "easeInCubic", 100.0 ],
[ 0.2, "easeOutCubic", 150.0 ],
[ 0.8, "linear", 200.0 ]
]
}
]
}
]

View File

@ -1,40 +0,0 @@
[
{
"type" : "ClutterRectangle",
"id" : "foo",
"x" : 0,
"y" : 0,
"width" : 100,
"height" : 100
},
{
"type" : "ClutterAnimator",
"id" : "animator",
"duration" : 1000,
"properties" : [
{
"object" : "foo",
"name" : "x",
"ease-in" : true,
"interpolation" : "linear",
"keys" : [
[ 0.0, "easeInCubic", 100.0 ],
[ 0.2, "easeOutCubic", 150.0 ],
[ 0.8, "linear", 200.0 ]
]
},
{
"object" : "foo",
"name" : "y",
"ease-in" : true,
"interpolation" : "linear",
"keys" : [
[ 0.0, "easeInCubic", 100.0 ],
[ 0.2, "easeOutCubic", 150.0 ],
[ 0.8, "linear", 200.0 ]
]
}
]
}
]

View File

@ -2,7 +2,7 @@
{ "id" : "manager", "type" : "ClutterBoxLayout" },
{
"id" : "container", "type" : "ClutterBox",
"id" : "container", "type" : "ClutterActor",
"layout-manager" : "manager",
"children" : [
{

View File

@ -1,10 +1,9 @@
[
{
"id" : "layout",
"type" : "ClutterBoxLayout",
"orientation" : "vertical",
"spacing" : 12,
"pack-start" : false
"type" : "ClutterGridLayout",
"row-spacing" : 6,
"column-spacing" : 12
},
{
"type" : "ClutterStage",
@ -12,7 +11,7 @@
"children" : [
{
"id" : "test",
"type" : "ClutterBox",
"type" : "ClutterActor",
"layout-manager" : "layout",
"children" : [
{

View File

@ -1,7 +1,7 @@
{
"id" : "test",
"type" : "ClutterBox",
"layout-manager" : { "id" : "layout", "type" : "ClutterBinLayout" },
"type" : "ClutterActor",
"layout-manager" : { "id" : "layout", "type" : "ClutterBoxLayout" },
"children" : [
{
"id" : "child-1",

View File

@ -1,33 +0,0 @@
[
{
"type" : "ClutterRectangle",
"id" : "rect",
"width" : 100,
"height" : 100
},
{
"type" : "ClutterState",
"id" : "state",
"transitions" : [
{
"source" : "base",
"target" : "clicked",
"duration" : 250,
"keys" : [
[ "rect", "opacity", "linear", 128 ]
]
},
{
"source" : "clicked",
"target" : "base",
"duration" : 150,
"keys" : [
[ "rect", "opacity", "linear", 255 ]
]
}
]
}
]

View File

@ -1,87 +0,0 @@
#include <clutter/clutter.h>
#include "test-conform-common.h"
void
state_base (TestConformSimpleFixture *fixture G_GNUC_UNUSED,
gconstpointer dummy G_GNUC_UNUSED)
{
ClutterScript *script = clutter_script_new ();
GObject *state = NULL;
GError *error = NULL;
gchar *test_file;
GList *states, *keys;
ClutterStateKey *state_key;
guint duration;
test_file = clutter_test_get_data_file ("test-state-1.json");
clutter_script_load_from_file (script, test_file, &error);
if (g_test_verbose () && error)
g_print ("Error: %s\n", error->message);
g_free (test_file);
#if GLIB_CHECK_VERSION (2, 20, 0)
g_assert_no_error (error);
#else
g_assert (error == NULL);
#endif
state = clutter_script_get_object (script, "state");
g_assert (CLUTTER_IS_STATE (state));
states = clutter_state_get_states (CLUTTER_STATE (state));
g_assert (states != NULL);
g_assert (g_list_find (states, g_intern_static_string ("clicked")));
g_list_free (states);
duration = clutter_state_get_duration (CLUTTER_STATE (state), "base", "clicked");
g_assert_cmpint (duration, ==, 250);
duration = clutter_state_get_duration (CLUTTER_STATE (state), "clicked", "base");
g_assert_cmpint (duration, ==, 150);
keys = clutter_state_get_keys (CLUTTER_STATE (state), "base", "clicked",
clutter_script_get_object (script, "rect"),
"opacity");
g_assert (keys != NULL);
g_assert_cmpint (g_list_length (keys), ==, 1);
state_key = keys->data;
g_assert (clutter_state_key_get_object (state_key) == clutter_script_get_object (script, "rect"));
g_assert (clutter_state_key_get_mode (state_key) == CLUTTER_LINEAR);
g_assert_cmpstr (clutter_state_key_get_property_name (state_key), ==, "opacity");
g_list_free (keys);
keys = clutter_state_get_keys (CLUTTER_STATE (state), NULL, NULL, NULL, NULL);
g_assert_cmpint (g_list_length (keys), ==, 2);
g_list_free (keys);
clutter_state_set (CLUTTER_STATE (state), "base", "clicked", state, "state", CLUTTER_LINEAR, "foo", NULL);
keys = clutter_state_get_keys (CLUTTER_STATE (state), "base", "clicked",
NULL, NULL);
g_assert (keys != NULL);
g_assert_cmpint (g_list_length (keys), ==, 2);
g_list_free (keys);
states = clutter_state_get_states (CLUTTER_STATE (state));
g_assert_cmpint (g_list_length (states), ==, 2);
g_list_free (states);
clutter_state_remove_key (CLUTTER_STATE (state), NULL, "clicked", NULL, NULL);
states = clutter_state_get_states (CLUTTER_STATE (state));
/* removing the "clicked" state, will also cause the "base" state to be removed
* since in the .json there is no default source state
*/
g_assert_cmpint (g_list_length (states), ==, 0);
g_list_free (states);
g_object_unref (script);
}

View File

@ -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 */

View File

@ -9,9 +9,6 @@ UNIT_TESTS = \
test-script.c \
test-grab.c \
test-cogl-shader-glsl.c \
test-animator.c \
test-state.c \
test-state-animator.c \
test-fbo.c \
test-multistage.c \
test-cogl-tex-tile.c \
@ -36,9 +33,7 @@ UNIT_TESTS = \
test-scrolling.c \
test-swipe-action.c \
test-cogl-point-sprites.c \
test-table-layout.c \
test-path-constraint.c \
test-state-script.c \
test-devices.c \
test-content.c \
test-keyframe-transition.c \

View File

@ -27,9 +27,6 @@ clutter_tests_interactive_test_sources = [
'test-script.c',
'test-grab.c',
'test-cogl-shader-glsl.c',
'test-animator.c',
'test-state.c',
'test-state-animator.c',
'test-fbo.c',
'test-multistage.c',
'test-cogl-tex-tile.c',
@ -54,9 +51,7 @@ clutter_tests_interactive_test_sources = [
'test-scrolling.c',
'test-swipe-action.c',
'test-cogl-point-sprites.c',
'test-table-layout.c',
'test-path-constraint.c',
'test-state-script.c',
'test-devices.c',
'test-content.c',
'test-keyframe-transition.c',

View File

@ -1,138 +0,0 @@
#include <stdlib.h>
#include <math.h>
#include <gmodule.h>
#include <clutter/clutter.h>
static ClutterAnimator *animator;
static ClutterActor *new_rect (gint r,
gint g,
gint b,
gint a)
{
GError *error = NULL;
ClutterColor *color = clutter_color_new (r, g, b, a);
ClutterActor *rectangle;
gchar *file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
rectangle = clutter_texture_new_from_file (file, &error);
if (rectangle == NULL)
g_error ("image load failed: %s", error->message);
g_free (file);
clutter_actor_set_size (rectangle, 128, 128);
clutter_color_free (color);
return rectangle;
}
static gboolean nuke_one (gpointer actor)
{
clutter_actor_destroy (actor);
return FALSE;
}
#define COUNT 4
static void reverse_timeline (ClutterTimeline *timeline,
gpointer data)
{
ClutterTimelineDirection direction = clutter_timeline_get_direction (timeline);
if (direction == CLUTTER_TIMELINE_FORWARD)
clutter_timeline_set_direction (timeline, CLUTTER_TIMELINE_BACKWARD);
else
clutter_timeline_set_direction (timeline, CLUTTER_TIMELINE_FORWARD);
clutter_timeline_start (timeline);
}
G_MODULE_EXPORT gint
test_animator_main (gint argc,
gchar **argv)
{
ClutterActor *stage;
ClutterActor *rects[COUNT];
gint i;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Animator");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
for (i = 0; i < COUNT; i++)
{
rects[i] = new_rect (255 * (i * 1.0 / COUNT), 50, 160, 255);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rects[i]);
clutter_actor_set_anchor_point (rects[i], 64, 64);
clutter_actor_set_position (rects[i], 320.0, 240.0);
clutter_actor_set_opacity (rects[i], 0x70);
}
clutter_threads_add_timeout (10000, nuke_one, rects[2]);
animator = clutter_animator_new ();
/* Note: when both animations are active for the same actor at the same
* time there is a race, such races should be handled by avoiding
* controlling the same properties from multiple animations. This is
* an intentional design flaw of this test for testing the corner case.
*/
clutter_animator_set (animator,
rects[0], "x", 1, 0.0, 180.0,
rects[0], "x", CLUTTER_LINEAR, 0.25, 450.0,
rects[0], "x", CLUTTER_LINEAR, 0.5, 450.0,
rects[0], "x", CLUTTER_LINEAR, 0.75, 180.0,
rects[0], "x", CLUTTER_LINEAR, 1.0, 180.0,
rects[0], "y", -1, 0.0, 100.0,
rects[0], "y", CLUTTER_LINEAR, 0.25, 100.0,
rects[0], "y", CLUTTER_LINEAR, 0.5, 380.0,
rects[0], "y", CLUTTER_LINEAR, 0.75, 380.0,
rects[0], "y", CLUTTER_LINEAR, 1.0, 100.0,
rects[3], "x", 0, 0.0, 180.0,
rects[3], "x", CLUTTER_LINEAR, 0.25, 180.0,
rects[3], "x", CLUTTER_LINEAR, 0.5, 450.0,
rects[3], "x", CLUTTER_LINEAR, 0.75, 450.0,
rects[3], "x", CLUTTER_LINEAR, 1.0, 180.0,
rects[3], "y", 0, 0.0, 100.0,
rects[3], "y", CLUTTER_LINEAR, 0.25, 380.0,
rects[3], "y", CLUTTER_LINEAR, 0.5, 380.0,
rects[3], "y", CLUTTER_LINEAR, 0.75, 100.0,
rects[3], "y", CLUTTER_LINEAR, 1.0, 100.0,
rects[2], "rotation-angle-y", 0, 0.0, 0.0,
rects[2], "rotation-angle-y", CLUTTER_LINEAR, 1.0, 360.0,
rects[1], "scale-x", 0, 0.0, 1.0,
rects[1], "scale-x", CLUTTER_LINEAR, 1.0, 2.0,
rects[1], "scale-y", 0, 0.0, 1.0,
rects[1], "scale-y", CLUTTER_LINEAR, 1.0, 2.0,
NULL);
clutter_actor_set_scale (rects[0], 1.4, 1.4);
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[0]), "x",
TRUE);
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[0]), "y",
TRUE);
clutter_animator_property_set_interpolation (animator, G_OBJECT (rects[0]),
"x", CLUTTER_INTERPOLATION_CUBIC);
clutter_animator_property_set_interpolation (animator, G_OBJECT (rects[0]),
"y", CLUTTER_INTERPOLATION_CUBIC);
clutter_stage_hide_cursor(CLUTTER_STAGE (stage));
clutter_actor_show (stage);
clutter_animator_set_duration (animator, 5000);
g_signal_connect (clutter_animator_start (animator),
"completed", G_CALLBACK (reverse_timeline), NULL);
clutter_main ();
g_object_unref (animator);
return EXIT_SUCCESS;
}

View File

@ -127,7 +127,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);

View File

@ -331,7 +331,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", "");

View File

@ -317,7 +317,7 @@ create_dummy_actor (guint width, guint height)
ClutterActor *group, *rect;
ClutterColor clr = { 0xff, 0xff, 0xff, 0xff};
group = clutter_group_new ();
group = clutter_actor_new ();
rect = clutter_rectangle_new_with_color (&clr);
clutter_actor_set_size (rect, width, height);
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");
/* 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);

View File

@ -17,7 +17,7 @@ make_source (void)
ClutterColor yellow = {0xff, 0xff, 0x00, 0xff};
source = clutter_group_new ();
source = clutter_actor_new ();
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
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 */
oh->group = clutter_group_new();
oh->group = clutter_actor_new();
oh->hand = g_new (ClutterActor*, n_hands);

View File

@ -257,7 +257,7 @@ test_pixmap_main (int argc, char **argv)
if (!disable_x11)
{
group = clutter_group_new ();
group = clutter_actor_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
label = clutter_text_new_with_text ("fixed",
"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);
group = clutter_group_new ();
group = clutter_actor_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
label = clutter_text_new_with_text ("fixed", "ClutterX11Texture (Pixmap)");
clutter_container_add_actor (CLUTTER_CONTAINER (group), label);

View File

@ -1,68 +0,0 @@
[
{
"id" : "button",
"type" : "ClutterRectangle",
"width" : "16 em",
"height" : "6 em",
"color" : "rgb(255, 0, 0)",
"opacity" : 128,
"scale-gravity" : "center",
"reactive" : true,
"signals" : [
{
"name" : "button-press-event",
"handler" : "on_button_press"
},
{ "name" : "enter-event", "states" : "button-states", "target-state" : "hover" },
{ "name" : "leave-event", "states" : "button-states", "target-state" : "base" },
{ "name" : "button-press-event", "states" : "button-states", "target-state" : "active" },
{ "name" : "button-release-event", "states" : "button-states", "target-state" : "hover" }
]
},
{
"id" : "button-states",
"type" : "ClutterState",
"duration" : 250,
"transitions" : [
{
"source" : null,
"target" : "base",
"keys" : [
[ "button", "opacity", "linear", 128 ],
[ "button", "scale-x", "ease-in-cubic", 1.0 ],
[ "button", "scale-y", "ease-in-cubic", 1.0 ],
[ "button", "color", "linear", "rgb(255, 0, 0)" ]
]
},
{
"source" : null,
"target" : "hover",
"keys" : [
[ "button", "opacity", "linear", 255 ],
[ "button", "scale-x", "ease-out-bounce", 1.4 ],
[ "button", "scale-y", "ease-out-bounce", 1.4 ],
[ "button", "color", "linear", "rgb(0, 255, 0)" ]
]
},
{
"source" : null,
"target" : "active",
"keys" : [
[ "button", "opacity", "linear", 255 ],
[ "button", "color", "linear", "rgb(0, 0, 255)" ]
]
}
]
}
]

View File

@ -1,144 +0,0 @@
#include <stdlib.h>
#include <math.h>
#include <gmodule.h>
#include <clutter/clutter.h>
static ClutterState *state;
static ClutterAnimator *animator;
static gboolean press_event (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
clutter_grab_pointer (actor);
clutter_state_set_state (state, "end");
return TRUE;
}
static gboolean release_event (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
clutter_state_set_state (state, "start");
clutter_ungrab_pointer ();
return TRUE;
}
static ClutterActor *new_rect (gint r,
gint g,
gint b,
gint a)
{
GError *error = NULL;
ClutterColor *color = clutter_color_new (r, g, b, a);
ClutterActor *rectangle;
gchar *file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
rectangle = clutter_texture_new_from_file (file, &error);
if (rectangle == NULL)
g_error ("image load failed: %s", error->message);
g_free (file);
clutter_actor_set_size (rectangle, 128, 128);
clutter_color_free (color);
return rectangle;
}
G_MODULE_EXPORT gint
test_state_animator_main (gint argc,
gchar **argv)
{
ClutterActor *stage;
ClutterActor *rects[40];
gint i;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "State and Animator");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
for (i = 0; i < 2; i++)
{
rects[i] = new_rect (255 * (i * 1.0 / 40), 50, 160, 255);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rects[i]);
clutter_actor_set_anchor_point (rects[i], 64, 64);
clutter_actor_set_position (rects[i], 320.0, 240.0);
clutter_actor_set_opacity (rects[i], 0x70);
clutter_actor_set_reactive (rects[i], TRUE);
g_signal_connect (rects[i], "button-press-event", G_CALLBACK (press_event), NULL);
g_signal_connect (rects[i], "button-release-event", G_CALLBACK (release_event), NULL);
}
state = clutter_state_new ();
clutter_state_set (state, NULL, "start",
rects[0], "depth", CLUTTER_LINEAR, 0.0,
rects[0], "x", CLUTTER_LINEAR, 100.0,
rects[0], "y", CLUTTER_LINEAR, 300.0,
rects[1], "opacity", CLUTTER_LINEAR, 0x20,
rects[1], "scale-x", CLUTTER_LINEAR, 1.0,
rects[1], "scale-y", CLUTTER_LINEAR, 1.0,
NULL);
clutter_state_set (state, NULL, "end",
rects[0], "depth", CLUTTER_LINEAR, 200.0,
rects[0], "x", CLUTTER_LINEAR, 320.0,
rects[0], "y", CLUTTER_LINEAR, 240.0,
rects[1], "opacity", CLUTTER_LINEAR, 0xff,
rects[1], "scale-x", CLUTTER_LINEAR, 2.0,
rects[1], "scale-y", CLUTTER_LINEAR, 2.0,
NULL);
animator = clutter_animator_new ();
clutter_animator_set (animator,
rects[0], "depth", -1, 0.0, 0.0,
rects[0], "depth", CLUTTER_LINEAR, 1.0, 275.0,
rects[0], "x", -1, 0.0, 0.0,
rects[0], "x", CLUTTER_LINEAR, 0.5, 200.0,
rects[0], "x", CLUTTER_LINEAR, 1.0, 320.0,
rects[0], "y", -1, 0.0, 0.0,
rects[0], "y", CLUTTER_LINEAR, 0.3, 100.0,
rects[0], "y", CLUTTER_LINEAR, 1.0, 240.0,
rects[1], "opacity", -1, 0.0, 0x20,
rects[1], "opacity", CLUTTER_LINEAR, 1.0, 0xff,
rects[1], "scale-x", -1, 0.0, 1.0,
rects[1], "scale-x", CLUTTER_LINEAR, 0.5, 2.0,
rects[1], "scale-x", CLUTTER_LINEAR, 1.0, 2.0,
rects[1], "scale-y", -1, 0.0, 1.0,
rects[1], "scale-y", CLUTTER_LINEAR, 0.5, 2.0,
rects[1], "scale-y", CLUTTER_LINEAR, 1.0, 2.0,
NULL);
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[0]), "depth", TRUE);
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[0]), "x", TRUE);
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[0]), "y", TRUE);
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[1]), "opacity", TRUE);
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[1]), "scale-x", TRUE);
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[1]), "scale-y", TRUE);
clutter_animator_property_set_interpolation (animator, G_OBJECT (rects[0]), "x",
CLUTTER_INTERPOLATION_CUBIC);
clutter_animator_property_set_interpolation (animator, G_OBJECT (rects[0]), "y",
CLUTTER_INTERPOLATION_CUBIC);
clutter_state_set_animator (state, "start", "end", animator);
g_object_unref (animator);
clutter_actor_show (stage);
clutter_state_set_state (state, "start");
clutter_main ();
g_object_unref (state);
return EXIT_SUCCESS;
}
G_MODULE_EXPORT const char *
test_state_animator_describe (void)
{
return "Animate using the State and Animator classes.";
}

View File

@ -1,53 +0,0 @@
#include <stdlib.h>
#include <gmodule.h>
#include <clutter/clutter.h>
#define TEST_STATE_SCRIPT_FILE "test-script-signals.json"
gboolean
on_button_press (ClutterActor *actor,
ClutterEvent *event,
gpointer dummy G_GNUC_UNUSED)
{
g_print ("Button pressed!\n");
return FALSE;
}
G_MODULE_EXPORT int
test_state_script_main (int argc, char *argv[])
{
ClutterActor *stage, *button;
ClutterScript *script;
GError *error = NULL;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return EXIT_FAILURE;
script = clutter_script_new ();
clutter_script_load_from_file (script, TEST_STATE_SCRIPT_FILE, &error);
if (error != NULL)
g_error ("Unable to load '%s': %s\n",
TEST_STATE_SCRIPT_FILE,
error->message);
stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Script");
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
clutter_actor_show (stage);
button = CLUTTER_ACTOR (clutter_script_get_object (script, "button"));
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button);
clutter_actor_add_constraint (button, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
clutter_script_connect_signals (script, NULL);
clutter_main ();
g_object_unref (script);
return EXIT_SUCCESS;
}

View File

@ -1,206 +0,0 @@
#include <stdlib.h>
#include <math.h>
#include <gmodule.h>
#include <clutter/clutter.h>
#define STAGE_WIDTH 1024
#define STAGE_HEIGHT 768
#define ACTOR_WIDTH 128
#define ACTOR_HEIGHT 128
#define COLS (STAGE_WIDTH/ACTOR_WIDTH)
#define ROWS (STAGE_HEIGHT/ACTOR_HEIGHT)
#define TOTAL (ROWS*COLS)
static gboolean press_event (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
ClutterState *state = CLUTTER_STATE (user_data);
clutter_state_set_state (state, "right");
return TRUE;
}
static gboolean release_event (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
ClutterState *state = CLUTTER_STATE (user_data);
clutter_state_set_state (state, "active");
return TRUE;
}
static gboolean enter_event (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
ClutterState *state = CLUTTER_STATE (user_data);
clutter_state_set_state (state, "hover");
return TRUE;
}
static gboolean leave_event (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
ClutterState *state = CLUTTER_STATE (user_data);
clutter_state_set_state (state, "normal");
return TRUE;
}
static void completed (ClutterState *state,
gpointer data)
{
g_print ("Completed transitioning to state: %s\n",
clutter_state_get_state (state));
if (g_str_equal (clutter_state_get_state (state), "right"))
{
/* skip straight to left state when reaching right */
clutter_state_warp_to_state (state, "left");
}
}
static ClutterActor *new_rect (gint r,
gint g,
gint b,
gint a)
{
GError *error = NULL;
ClutterColor *color = clutter_color_new (r, g, b, a);
ClutterActor *group = clutter_actor_new ();
ClutterActor *rectangle = clutter_actor_new ();
ClutterActor *hand = NULL;
gchar *file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
hand = clutter_texture_new_from_file (file, &error);
if (rectangle == NULL)
g_error ("image load failed: %s", error->message);
g_free (file);
clutter_actor_set_size (hand, ACTOR_WIDTH,ACTOR_HEIGHT);
clutter_actor_set_background_color (rectangle, color);
clutter_actor_set_size (rectangle, ACTOR_WIDTH,ACTOR_HEIGHT);
clutter_color_free (color);
clutter_actor_add_child (group, rectangle);
clutter_actor_add_child (group, hand);
return group;
}
G_MODULE_EXPORT gint
test_state_main (gint argc,
gchar **argv)
{
ClutterActor *stage;
ClutterState *layout_state;
gint i;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
layout_state = clutter_state_new ();
stage = clutter_stage_new ();
clutter_actor_set_background_color (stage, CLUTTER_COLOR_Black);
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Machine");
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
g_signal_connect (stage, "button-press-event",
G_CALLBACK (press_event), layout_state);
g_signal_connect (stage, "button-release-event",
G_CALLBACK (release_event), layout_state);
for (i = 0; i < TOTAL; i++)
{
ClutterActor *actor;
ClutterState *a_state;
int row = i/COLS;
int col = i%COLS;
actor = new_rect (255 * (1.0 * col / COLS), 50,
255 * (1.0 * row / ROWS), 255);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
clutter_actor_set_position (actor, 320.0, 240.0);
clutter_actor_set_reactive (actor, TRUE);
clutter_actor_add_effect_with_name (actor, "fade",
clutter_desaturate_effect_new (0.0));
clutter_state_set (layout_state, NULL, "active",
actor, "delayed::x", CLUTTER_LINEAR,
ACTOR_WIDTH * 1.0 * ((TOTAL-1-i) % COLS),
((row*1.0/ROWS))/2, (1.0-(row*1.0/ROWS))/2,
actor, "delayed::y", CLUTTER_LINEAR,
ACTOR_HEIGHT * 1.0 * ((TOTAL-1-i) / COLS),
((row*1.0/ROWS))/2, 0.0,
actor, "rotation-angle-x", CLUTTER_LINEAR, 0.0,
actor, "rotation-angle-y", CLUTTER_LINEAR, 0.0,
NULL);
clutter_state_set (layout_state, NULL, "right",
actor, "delayed::x", CLUTTER_LINEAR, STAGE_WIDTH * 1.0,
((row*1.0/ROWS))/2,
(1.0-(row*1.0/ROWS))/2,
actor, "delayed::y", CLUTTER_LINEAR, STAGE_HEIGHT * 1.0,
((row*1.0/ROWS))/2,
0.0,
NULL);
clutter_state_set (layout_state, NULL, "left",
actor, "rotation-angle-x", CLUTTER_LINEAR, 45.0,
actor, "rotation-angle-y", CLUTTER_LINEAR, 5.0,
actor, "x", CLUTTER_LINEAR, 0-64.0,
actor, "y", CLUTTER_LINEAR, 0-64.0,
NULL);
a_state = clutter_state_new ();
g_object_set_data_full (G_OBJECT (actor), "hover-state-machine",
a_state, g_object_unref);
g_signal_connect (actor, "enter-event",
G_CALLBACK (enter_event), a_state);
g_signal_connect (actor, "leave-event",
G_CALLBACK (leave_event), a_state);
clutter_state_set (a_state, NULL, "normal",
actor, "opacity", CLUTTER_LINEAR, 0x77,
actor, "rotation-angle-z", CLUTTER_LINEAR, 0.0,
actor, "@effects.fade.factor", CLUTTER_LINEAR, 0.0,
NULL);
clutter_state_set (a_state, NULL, "hover",
actor, "opacity", CLUTTER_LINEAR, 0xff,
actor, "rotation-angle-z", CLUTTER_LINEAR, 10.0,
actor, "@effects.fade.factor", CLUTTER_LINEAR, 1.0,
NULL);
clutter_actor_set_opacity (actor, 0x77);
clutter_state_set_duration (a_state, NULL, NULL, 500);
}
clutter_state_set_duration (layout_state, NULL, NULL, 1000);
clutter_state_set_duration (layout_state, "active", "left", 1400);
g_signal_connect (layout_state, "completed", G_CALLBACK (completed), NULL);
clutter_actor_show (stage);
clutter_state_warp_to_state (layout_state, "left");
clutter_state_set_state (layout_state, "active");
clutter_main ();
g_object_unref (layout_state);
return EXIT_SUCCESS;
}
G_MODULE_EXPORT const char *
test_state_describe (void)
{
return "Animating using the State class.";
}

View File

@ -128,44 +128,32 @@ test_swipe_action_main (int argc, char *argv[])
attach_action (rect, BOTH);
{
ClutterLayoutManager *layout = clutter_box_layout_new ();
ClutterLayoutManager *layout = clutter_grid_layout_new ();
ClutterActor *box, *label;
float offset;
clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (layout), TRUE);
clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (layout), 6);
clutter_grid_layout_set_orientation (CLUTTER_GRID_LAYOUT (layout),
CLUTTER_ORIENTATION_VERTICAL);
clutter_grid_layout_set_row_spacing (CLUTTER_GRID_LAYOUT (layout), 6);
clutter_grid_layout_set_column_spacing (CLUTTER_GRID_LAYOUT (layout), 6);
box = clutter_box_new (layout);
box = clutter_actor_new ();
clutter_actor_set_layout_manager (box, layout);
label = clutter_text_new ();
clutter_text_set_markup (CLUTTER_TEXT (label),
"<b>Red</b>: vertical swipes only");
clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (layout),
label,
TRUE,
TRUE, TRUE,
CLUTTER_BOX_ALIGNMENT_START,
CLUTTER_BOX_ALIGNMENT_CENTER);
clutter_actor_add_child (box, label);
label = clutter_text_new ();
clutter_text_set_markup (CLUTTER_TEXT (label),
"<b>Blue</b>: horizontal swipes only");
clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (layout),
label,
TRUE,
TRUE, TRUE,
CLUTTER_BOX_ALIGNMENT_START,
CLUTTER_BOX_ALIGNMENT_CENTER);
clutter_actor_add_child (box, label);
label = clutter_text_new ();
clutter_text_set_markup (CLUTTER_TEXT (label),
"<b>Green</b>: both");
clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (layout),
label,
TRUE,
TRUE, TRUE,
CLUTTER_BOX_ALIGNMENT_START,
CLUTTER_BOX_ALIGNMENT_CENTER);
clutter_actor_add_child (box, label);
offset = clutter_actor_get_height (stage)
- clutter_actor_get_height (box)

View File

@ -1,284 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <gmodule.h>
#include <clutter/clutter.h>
#include <cogl/cogl.h>
#include <cogl-pango/cogl-pango.h>
#define FONT "Sans 12"
static void
set_text (ClutterActor *actor, const gchar *text)
{
GList *children, *l;
children = clutter_container_get_children (CLUTTER_CONTAINER (actor));
for (l = children; l; l = g_list_next (l)) {
if (CLUTTER_IS_TEXT (l->data)) {
clutter_text_set_text (CLUTTER_TEXT (l->data), text);
break;
}
}
g_list_free (children);
}
static void
toggle_expand (ClutterActor *actor, ClutterEvent *event, ClutterBox *box)
{
gboolean x_expand;
gchar *label;
ClutterLayoutManager *layout = clutter_box_get_layout_manager (box);
clutter_layout_manager_child_get (layout, CLUTTER_CONTAINER (box), actor,
"x-expand", &x_expand,
NULL);
x_expand = !x_expand;
clutter_layout_manager_child_set (layout, CLUTTER_CONTAINER (box), actor,
"x-expand", x_expand,
"y-expand", x_expand,
NULL);
label = g_strdup_printf ("Expand = %d", x_expand);
set_text (actor, label);
g_free (label);
}
static const gchar *
get_alignment_name (ClutterTableAlignment alignment)
{
switch (alignment)
{
case CLUTTER_TABLE_ALIGNMENT_START:
return "start";
case CLUTTER_TABLE_ALIGNMENT_CENTER:
return "center";
case CLUTTER_TABLE_ALIGNMENT_END:
return "end";
}
return "undefined";
}
static void
randomise_align (ClutterActor *actor, ClutterEvent *event, ClutterBox *box)
{
ClutterTableAlignment x_align, y_align;
gchar *label;
ClutterLayoutManager *layout;
layout = clutter_box_get_layout_manager (box);
x_align = (ClutterTableAlignment) g_random_int_range (0, 3);
y_align = (ClutterTableAlignment) g_random_int_range (0, 3);
clutter_layout_manager_child_set (layout, CLUTTER_CONTAINER (box), actor,
"x-align", x_align,
"y-align", y_align,
NULL);
label = g_strdup_printf ("Align (%s, %s)",
get_alignment_name (x_align),
get_alignment_name (y_align));
set_text (actor, label);
g_free (label);
}
static void
toggle_visible (ClutterActor *actor, ClutterEvent *event, gpointer userdata)
{
clutter_actor_hide (actor);
}
gboolean drag = FALSE;
static ClutterActor *
create_cell (ClutterActor *actor, const gchar *color_str)
{
ClutterActor *result;
ClutterActor *rectangle;
ClutterColor color;
result =
clutter_box_new (clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FILL,
CLUTTER_BIN_ALIGNMENT_FILL));
rectangle = clutter_rectangle_new ();
clutter_color_from_string (&color, color_str);
clutter_rectangle_set_color (CLUTTER_RECTANGLE (rectangle), (const ClutterColor *) &color);
clutter_color_from_string (&color, "#000f");
clutter_rectangle_set_border_color (CLUTTER_RECTANGLE (rectangle), (const ClutterColor *) &color);
clutter_rectangle_set_border_width (CLUTTER_RECTANGLE (rectangle), 2);
clutter_actor_show (rectangle);
clutter_actor_set_reactive (result, TRUE);
clutter_container_add_actor (CLUTTER_CONTAINER (result), rectangle);
clutter_box_pack (CLUTTER_BOX (result), actor,
"x-align", CLUTTER_BIN_ALIGNMENT_CENTER,
"y-align", CLUTTER_BIN_ALIGNMENT_CENTER,
NULL);
return result;
}
static ClutterActor *
create_text (const gchar *label, const gchar *color)
{
ClutterActor *text;
ClutterActor *result;
text = clutter_text_new_with_text (FONT, label);
clutter_actor_show (text);
result = create_cell (text, color);
clutter_actor_show (result);
return result;
}
static ClutterActor *
create_image (const gchar *file, const gchar *color)
{
ClutterActor *texture;
ClutterActor *result;
texture = clutter_texture_new_from_file (file, NULL);
g_object_set (G_OBJECT (texture), "keep-aspect-ratio", TRUE, NULL);
clutter_actor_show (texture);
result = create_cell (texture, color);
clutter_actor_show (result);
return result;
}
G_MODULE_EXPORT int
test_table_layout_main (int argc, char *argv[])
{
ClutterActor *stage;
ClutterLayoutManager *layout;
ClutterActor *actor1, *actor2, *actor3, *actor4, *actor5, *actor6, *actor7, *actor8, *actor9, *actor10;
ClutterActor *box;
gchar *file;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Table Layout");
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
clutter_actor_set_size (stage, 640, 480);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
layout = clutter_table_layout_new ();
clutter_table_layout_set_column_spacing (CLUTTER_TABLE_LAYOUT (layout), 10);
clutter_table_layout_set_row_spacing (CLUTTER_TABLE_LAYOUT (layout), 10);
clutter_table_layout_set_use_animations (CLUTTER_TABLE_LAYOUT (layout), TRUE);
box = clutter_box_new (layout);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_WIDTH, -10.0));
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_HEIGHT, -10.0));
actor1 = create_text ("label 1", "#f66f");
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
actor2 = create_image (file, "#bbcf");
g_free (file);
actor3 = create_text ("label 3", "#6f6f");
actor4 = create_text ("Expand = 1", "#66ff");
actor5 = create_text ("label 5", "#f6ff");
actor6 = create_text ("label 6", "#6fff");
actor7 = create_text ("Align (center, center)", "#66ff");
actor8 = create_text ("label 8", "#ffff");
actor9 = create_text ("label 9", "#666f");
actor10 = create_text ("label 10", "#aaaf");
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor1, 0, 0);
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor2, 1, 0);
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor3, 1, 1);
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor4, 0, 2);
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor5, 0, 3);
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor6, 1, 3);
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor7, 1, 4);
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor8, 0, 4);
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor9, 0, 5);
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor10, 0, -1);
clutter_table_layout_set_span (CLUTTER_TABLE_LAYOUT (layout), actor1, 1, 2);
clutter_table_layout_set_span (CLUTTER_TABLE_LAYOUT (layout), actor7, 1, 2);
clutter_table_layout_set_span (CLUTTER_TABLE_LAYOUT (layout), actor4, 2, 1);
clutter_actor_set_size (actor1, 100, 100);
clutter_actor_set_width (actor4, 250);
clutter_layout_manager_child_set (CLUTTER_LAYOUT_MANAGER (layout),
CLUTTER_CONTAINER (box),
actor1,
"x-expand", FALSE, "y-expand", FALSE,
NULL);
clutter_layout_manager_child_set (CLUTTER_LAYOUT_MANAGER (layout),
CLUTTER_CONTAINER (box),
actor4,
"x-expand", TRUE, "y-expand", TRUE,
"x-fill", TRUE, "y-fill", TRUE,
NULL);
clutter_layout_manager_child_set (CLUTTER_LAYOUT_MANAGER (layout),
CLUTTER_CONTAINER (box),
actor7,
"x-expand", TRUE, "y-expand", TRUE,
"x-fill", FALSE, "y-fill", FALSE,
NULL);
clutter_layout_manager_child_set (CLUTTER_LAYOUT_MANAGER (layout),
CLUTTER_CONTAINER (box),
actor8,
"x-expand", FALSE, "y-expand", FALSE,
NULL);
clutter_layout_manager_child_set (CLUTTER_LAYOUT_MANAGER (layout),
CLUTTER_CONTAINER (box),
actor9,
"x-expand", FALSE, "y-expand", FALSE,
NULL);
clutter_layout_manager_child_set (CLUTTER_LAYOUT_MANAGER (layout),
CLUTTER_CONTAINER (box),
actor2,
"y-fill", FALSE,
"x-fill", FALSE,
NULL);
clutter_actor_set_position (box, 5, 5);
g_signal_connect (actor4, "button-release-event", G_CALLBACK (toggle_expand), box);
g_signal_connect (actor7, "button-release-event", G_CALLBACK (randomise_align), box);
g_signal_connect (actor10, "button-release-event", G_CALLBACK (toggle_visible), NULL);
/* g_signal_connect (stage, "button-press-event", G_CALLBACK (button_press), */
/* box); */
/* g_signal_connect (stage, "motion-event", G_CALLBACK (motion_event), */
/* box); */
/* g_signal_connect (stage, "button-release-event", G_CALLBACK (button_release), */
/* box); */
clutter_actor_show (stage);
g_debug ("table row count = %d",
clutter_table_layout_get_row_count (CLUTTER_TABLE_LAYOUT (layout)));
g_debug ("table column count = %d",
clutter_table_layout_get_column_count (CLUTTER_TABLE_LAYOUT (layout)));
clutter_main ();
return EXIT_SUCCESS;
}
G_MODULE_EXPORT const char *
test_table_layout_describe (void)
{
return "TableLayout layout manager example.";
}

View File

@ -228,6 +228,7 @@ create_entry (const ClutterColor *color,
clutter_text_set_max_length (CLUTTER_TEXT (retval), max_length);
clutter_text_set_selected_text_color (CLUTTER_TEXT (retval), &selected_text);
clutter_actor_set_background_color (retval, CLUTTER_COLOR_LightGray);
clutter_actor_set_x_expand (retval, TRUE);
if (attrs)
clutter_text_set_attributes (CLUTTER_TEXT (retval), attrs);
@ -247,7 +248,7 @@ test_text_field_main (gint argc,
{
ClutterActor *stage;
ClutterActor *box, *label, *entry;
ClutterLayoutManager *table;
ClutterGridLayout *grid;
PangoAttrList *entry_attrs;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
@ -258,12 +259,12 @@ test_text_field_main (gint argc,
clutter_actor_set_background_color (stage, CLUTTER_COLOR_Black);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
table = clutter_table_layout_new ();
clutter_table_layout_set_column_spacing (CLUTTER_TABLE_LAYOUT (table), 6);
clutter_table_layout_set_row_spacing (CLUTTER_TABLE_LAYOUT (table), 6);
grid = CLUTTER_GRID_LAYOUT (clutter_grid_layout_new ());
clutter_grid_layout_set_column_spacing (grid, 6);
clutter_grid_layout_set_row_spacing (grid, 6);
box = clutter_actor_new ();
clutter_actor_set_layout_manager (box, table);
clutter_actor_set_layout_manager (box, grid);
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_WIDTH, -24.0));
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_HEIGHT, -24.0));
clutter_actor_set_position (box, 12, 12);
@ -271,46 +272,20 @@ test_text_field_main (gint argc,
label = create_label (CLUTTER_COLOR_White, "<b>Input field:</b>");
g_object_set (label, "min-width", 150.0, NULL);
clutter_actor_add_child (box, label);
clutter_layout_manager_child_set (table, CLUTTER_CONTAINER (box), label,
"row", 0,
"column", 0,
"x-expand", FALSE,
"y-expand", FALSE,
NULL);
clutter_grid_layout_attach (grid, label, 0, 0, 1, 1);
entry_attrs = pango_attr_list_new ();
pango_attr_list_insert (entry_attrs, pango_attr_underline_new (PANGO_UNDERLINE_ERROR));
pango_attr_list_insert (entry_attrs, pango_attr_underline_color_new (65535, 0, 0));
entry = create_entry (CLUTTER_COLOR_Black, "somme misspeeled textt", entry_attrs, 0, 0);
clutter_actor_add_child (box, entry);
clutter_layout_manager_child_set (table, CLUTTER_CONTAINER (box), entry,
"row", 0,
"column", 1,
"x-expand", TRUE,
"x-fill", TRUE,
"y-expand", FALSE,
NULL);
clutter_grid_layout_attach (grid, entry, 1, 0, 1, 1);
clutter_actor_grab_key_focus (entry);
label = create_label (CLUTTER_COLOR_White, "<b>A very long password field:</b>");
clutter_actor_add_child (box, label);
clutter_layout_manager_child_set (table, CLUTTER_CONTAINER (box), label,
"row", 1,
"column", 0,
"x-expand", FALSE,
"y-expand", FALSE,
NULL);
clutter_grid_layout_attach (grid, label, 0, 1, 1, 1);
entry = create_entry (CLUTTER_COLOR_Black, "password", NULL, '*', 8);
clutter_actor_add_child (box, entry);
clutter_layout_manager_child_set (table, CLUTTER_CONTAINER (box), entry,
"row", 1,
"column", 1,
"x-expand", TRUE,
"x-fill", TRUE,
"y-expand", FALSE,
NULL);
clutter_grid_layout_attach (grid, entry, 1, 1, 1, 1);
clutter_actor_show (stage);

View File

@ -18,7 +18,8 @@ test_texture_material_main (int argc, char *argv[])
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
manager = clutter_flow_layout_new (CLUTTER_FLOW_HORIZONTAL);
box = clutter_box_new (manager);
box = clutter_actor_new ();
clutter_actor_set_layout_manager (box, manager);
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_WIDTH, -25.0));
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_HEIGHT, -25.0));
clutter_actor_set_position (box, 25.0, 25.0);

View File

@ -56,7 +56,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);

View File

@ -1,11 +1,6 @@
check_PROGRAMS = \
test-picking \
test-text-perf \
test-state \
test-state-interactive \
test-state-hidden \
test-state-mini \
test-state-pick
test-text-perf
common_ldadd = $(top_builddir)/clutter/libmutter-clutter-@LIBMUTTER_API_VERSION@.la

View File

@ -11,11 +11,6 @@ clutter_tests_performance_c_args += clutter_debug_c_args
clutter_tests_performance_tests = [
'test-picking',
'test-text-perf',
'test-state',
'test-state-interactive',
'test-state-hidden',
'test-state-mini',
'test-state-pick',
]
foreach test : clutter_tests_performance_tests

View File

@ -1,150 +0,0 @@
#include <stdlib.h>
#include <math.h>
#include <gmodule.h>
#include <clutter/clutter.h>
#include "test-common.h"
#define STAGE_WIDTH 160
#define STAGE_HEIGHT 120
#define ACTOR_WIDTH 8
#define ACTOR_HEIGHT 8
#define COLS (STAGE_WIDTH/ACTOR_WIDTH)
#define ROWS (STAGE_HEIGHT/ACTOR_HEIGHT)
#define TOTAL (ROWS*COLS)
static void completed (ClutterState *state,
gpointer data)
{
if (g_str_equal (clutter_state_get_state (state), "right"))
{
/* skip straight to left state when reaching right */
clutter_state_warp_to_state (state, "left");
}
else if (g_str_equal (clutter_state_get_state (state), "active"))
clutter_state_set_state (state, "right");
else
{
clutter_state_set_state (state, "active");
}
}
static ClutterActor *new_rect (gint r,
gint g,
gint b,
gint a)
{
ClutterColor *color = clutter_color_new (r, g, b, a);
ClutterActor *group = clutter_group_new ();
ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
gchar *file = g_build_filename (TESTS_DATA_DIR, "redhand.png", NULL);
g_free (file);
clutter_actor_set_size (rectangle, ACTOR_WIDTH,ACTOR_HEIGHT);
clutter_color_free (color);
clutter_container_add (CLUTTER_CONTAINER (group), rectangle, NULL);
return group;
}
gint
main (gint argc,
gchar **argv)
{
ClutterActor *stage;
ClutterActor *group;
ClutterState *layout_state;
gint i;
clutter_perf_fps_init ();
if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv))
g_error ("Failed to initialize Clutter");
stage = clutter_stage_new ();
group = clutter_group_new ();
layout_state = clutter_state_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Performance [hidden]");
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
for (i=0; i<TOTAL; i++)
{
ClutterActor *actor;
ClutterState *a_state;
int row = i/COLS;
int col = i%COLS;
actor = new_rect (255 * ( 1.0*col/COLS), 50,
255 * ( 1.0*row/ROWS), 255);
clutter_container_add_actor (CLUTTER_CONTAINER (group), actor);
clutter_actor_set_position (actor, 320.0, 240.0);
clutter_actor_set_reactive (actor, TRUE);
clutter_state_set (layout_state, NULL, "active",
actor, "delayed::x", CLUTTER_LINEAR,
ACTOR_WIDTH * 1.0 * ((TOTAL-1-i) % COLS),
((row*1.0/ROWS))/2, (1.0-(row*1.0/ROWS))/2,
actor, "delayed::y", CLUTTER_LINEAR,
ACTOR_HEIGHT * 1.0 * ((TOTAL-1-i) / COLS),
((row*1.0/ROWS))/2, 0.0,
actor, "rotation-angle-x", CLUTTER_LINEAR, 0.0,
actor, "rotation-angle-y", CLUTTER_LINEAR, 0.0,
NULL);
clutter_state_set (layout_state, NULL, "right",
actor, "delayed::x", CLUTTER_LINEAR, STAGE_WIDTH * 1.0,
((row*1.0/ROWS))/2,
(1.0-(row*1.0/ROWS))/2,
actor, "delayed::y", CLUTTER_LINEAR, STAGE_HEIGHT * 1.0,
((row*1.0/ROWS))/2,
0.0,
NULL);
clutter_state_set (layout_state, NULL, "left",
actor, "rotation-angle-x", CLUTTER_LINEAR, 45.0,
actor, "rotation-angle-y", CLUTTER_LINEAR, 5.0,
actor, "x", CLUTTER_LINEAR, 0-64.0,
actor, "y", CLUTTER_LINEAR, 0-64.0,
NULL);
a_state = clutter_state_new ();
g_object_set_data_full (G_OBJECT (actor), "hover-state-machine",
a_state, g_object_unref);
clutter_state_set (a_state, NULL, "normal",
actor, "opacity", CLUTTER_LINEAR, 0x77,
actor, "rotation-angle-z", CLUTTER_LINEAR, 0.0,
NULL);
clutter_state_set (a_state, NULL, "hover",
actor, "opacity", CLUTTER_LINEAR, 0xff,
actor, "rotation-angle-z", CLUTTER_LINEAR, 10.0,
NULL);
clutter_actor_set_opacity (actor, 0x77);
clutter_state_set_duration (a_state, NULL, NULL, 500);
}
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
clutter_actor_set_opacity (group, 0);
clutter_state_set_duration (layout_state, NULL, NULL, 1000);
clutter_state_set_duration (layout_state, "active", "left", 1400);
g_signal_connect (layout_state, "completed", G_CALLBACK (completed), NULL);
clutter_actor_show (stage);
clutter_state_warp_to_state (layout_state, "left");
clutter_state_set_state (layout_state, "active");
clutter_perf_fps_start (CLUTTER_STAGE (stage));
clutter_main ();
clutter_perf_fps_report ("test-state-hidden");
g_object_unref (layout_state);
return EXIT_SUCCESS;
}

View File

@ -1,194 +0,0 @@
#include <stdlib.h>
#include <math.h>
#include <gmodule.h>
#include <clutter/clutter.h>
#include "test-common.h"
#define STAGE_WIDTH 800
#define STAGE_HEIGHT 600
#define ACTOR_WIDTH 64
#define ACTOR_HEIGHT 64
#define COLS (STAGE_WIDTH/ACTOR_WIDTH)
#define ROWS (STAGE_HEIGHT/ACTOR_HEIGHT)
#define TOTAL (ROWS*COLS)
static gboolean press_event (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
ClutterState *state = CLUTTER_STATE (user_data);
clutter_state_set_state (state, "right");
return TRUE;
}
static gboolean release_event (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
ClutterState *state = CLUTTER_STATE (user_data);
clutter_state_set_state (state, "active");
return TRUE;
}
static gboolean enter_event (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
ClutterState *state = CLUTTER_STATE (user_data);
clutter_state_set_state (state, "hover");
return TRUE;
}
static gboolean leave_event (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
ClutterState *state = CLUTTER_STATE (user_data);
clutter_state_set_state (state, "normal");
return TRUE;
}
static void completed (ClutterState *state,
gpointer data)
{
g_print ("Completed transitioning to state: %s\n",
clutter_state_get_state (state));
if (g_str_equal (clutter_state_get_state (state), "right"))
{
/* skip straight to left state when reaching right */
clutter_state_warp_to_state (state, "left");
}
}
static ClutterActor *new_rect (gint r,
gint g,
gint b,
gint a)
{
GError *error = NULL;
ClutterColor *color = clutter_color_new (r, g, b, a);
ClutterActor *group = clutter_group_new ();
ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
ClutterActor *hand = NULL;
gchar *file = g_build_filename (TESTS_DATA_DIR, "redhand.png", NULL);
hand = clutter_texture_new_from_file (file, &error);
if (rectangle == NULL)
g_error ("image load failed: %s", error->message);
g_free (file);
clutter_actor_set_size (hand, ACTOR_WIDTH,ACTOR_HEIGHT);
clutter_actor_set_size (rectangle, ACTOR_WIDTH,ACTOR_HEIGHT);
clutter_color_free (color);
clutter_container_add (CLUTTER_CONTAINER (group), rectangle, hand, NULL);
return group;
}
gint
main (gint argc,
gchar **argv)
{
ClutterActor *stage;
ClutterState *layout_state;
gint i;
clutter_perf_fps_init ();
if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv))
g_error ("Failed to initialize Clutter");
stage = clutter_stage_new ();
layout_state = clutter_state_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Performance [interactive]");
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
g_signal_connect (stage, "button-press-event",
G_CALLBACK (press_event), layout_state);
g_signal_connect (stage, "button-release-event",
G_CALLBACK (release_event), layout_state);
for (i=0; i<TOTAL; i++)
{
ClutterActor *actor;
ClutterState *a_state;
int row = i/COLS;
int col = i%COLS;
actor = new_rect (255 * ( 1.0*col/COLS), 50,
255 * ( 1.0*row/ROWS), 255);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
clutter_actor_set_position (actor, 320.0, 240.0);
clutter_actor_set_reactive (actor, TRUE);
clutter_state_set (layout_state, NULL, "active",
actor, "delayed::x", CLUTTER_LINEAR,
ACTOR_WIDTH * 1.0 * ((TOTAL-1-i) % COLS),
((row*1.0/ROWS))/2, (1.0-(row*1.0/ROWS))/2,
actor, "delayed::y", CLUTTER_LINEAR,
ACTOR_HEIGHT * 1.0 * ((TOTAL-1-i) / COLS),
((row*1.0/ROWS))/2, 0.0,
actor, "rotation-angle-x", CLUTTER_LINEAR, 0.0,
actor, "rotation-angle-y", CLUTTER_LINEAR, 0.0,
NULL);
clutter_state_set (layout_state, NULL, "right",
actor, "delayed::x", CLUTTER_LINEAR, STAGE_WIDTH * 1.0,
((row*1.0/ROWS))/2,
(1.0-(row*1.0/ROWS))/2,
actor, "delayed::y", CLUTTER_LINEAR, STAGE_HEIGHT * 1.0,
((row*1.0/ROWS))/2,
0.0,
NULL);
clutter_state_set (layout_state, NULL, "left",
actor, "rotation-angle-x", CLUTTER_LINEAR, 45.0,
actor, "rotation-angle-y", CLUTTER_LINEAR, 5.0,
actor, "x", CLUTTER_LINEAR, 0-64.0,
actor, "y", CLUTTER_LINEAR, 0-64.0,
NULL);
a_state = clutter_state_new ();
g_object_set_data_full (G_OBJECT (actor), "hover-state-machine",
a_state, g_object_unref);
g_signal_connect (actor, "enter-event",
G_CALLBACK (enter_event), a_state);
g_signal_connect (actor, "leave-event",
G_CALLBACK (leave_event), a_state);
clutter_state_set (a_state, NULL, "normal",
actor, "opacity", CLUTTER_LINEAR, 0x77,
actor, "rotation-angle-z", CLUTTER_LINEAR, 0.0,
NULL);
clutter_state_set (a_state, NULL, "hover",
actor, "opacity", CLUTTER_LINEAR, 0xff,
actor, "rotation-angle-z", CLUTTER_LINEAR, 10.0,
NULL);
clutter_actor_set_opacity (actor, 0x77);
clutter_state_set_duration (a_state, NULL, NULL, 500);
}
clutter_state_set_duration (layout_state, NULL, NULL, 1000);
clutter_state_set_duration (layout_state, "active", "left", 1400);
g_signal_connect (layout_state, "completed", G_CALLBACK (completed), NULL);
clutter_actor_show (stage);
clutter_state_warp_to_state (layout_state, "left");
clutter_state_set_state (layout_state, "active");
clutter_perf_fake_mouse (CLUTTER_STAGE (stage));
clutter_perf_fps_start (CLUTTER_STAGE (stage));
clutter_main ();
clutter_perf_fps_report ("test-state-interactive");
g_object_unref (layout_state);
return EXIT_SUCCESS;
}

View File

@ -1,153 +0,0 @@
#include <stdlib.h>
#include <math.h>
#include <gmodule.h>
#include <clutter/clutter.h>
#include "test-common.h"
#define STAGE_WIDTH 160
#define STAGE_HEIGHT 120
#define ACTOR_WIDTH 8
#define ACTOR_HEIGHT 8
#define COLS (STAGE_WIDTH/ACTOR_WIDTH)
#define ROWS (STAGE_HEIGHT/ACTOR_HEIGHT)
#define TOTAL (ROWS*COLS)
static void completed (ClutterState *state,
gpointer data)
{
if (g_str_equal (clutter_state_get_state (state), "right"))
{
/* skip straight to left state when reaching right */
clutter_state_warp_to_state (state, "left");
}
else if (g_str_equal (clutter_state_get_state (state), "active"))
clutter_state_set_state (state, "right");
else
{
clutter_state_set_state (state, "active");
}
}
static ClutterActor *new_rect (gint r,
gint g,
gint b,
gint a)
{
GError *error = NULL;
ClutterColor *color = clutter_color_new (r, g, b, a);
ClutterActor *group = clutter_group_new ();
ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
ClutterActor *hand = NULL;
gchar *file = g_build_filename (TESTS_DATA_DIR, "redhand.png", NULL);
hand = clutter_texture_new_from_file (file, &error);
if (rectangle == NULL)
g_error ("image load failed: %s", error->message);
g_free (file);
clutter_actor_set_size (hand, ACTOR_WIDTH,ACTOR_HEIGHT);
clutter_actor_set_size (rectangle, ACTOR_WIDTH,ACTOR_HEIGHT);
clutter_color_free (color);
clutter_container_add (CLUTTER_CONTAINER (group), rectangle, hand, NULL);
return group;
}
gint
main (gint argc,
gchar **argv)
{
ClutterActor *stage;
ClutterState *layout_state;
gint i;
clutter_perf_fps_init ();
if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv))
g_error ("Failed to initialize Clutter");
stage = clutter_stage_new ();
layout_state = clutter_state_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Performance [mini]");
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
for (i=0; i<TOTAL; i++)
{
ClutterActor *actor;
ClutterState *a_state;
int row = i/COLS;
int col = i%COLS;
actor = new_rect (255 * ( 1.0*col/COLS), 50,
255 * ( 1.0*row/ROWS), 255);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
clutter_actor_set_position (actor, 320.0, 240.0);
clutter_actor_set_reactive (actor, TRUE);
clutter_state_set (layout_state, NULL, "active",
actor, "delayed::x", CLUTTER_LINEAR,
ACTOR_WIDTH * 1.0 * ((TOTAL-1-i) % COLS),
((row*1.0/ROWS))/2, (1.0-(row*1.0/ROWS))/2,
actor, "delayed::y", CLUTTER_LINEAR,
ACTOR_HEIGHT * 1.0 * ((TOTAL-1-i) / COLS),
((row*1.0/ROWS))/2, 0.0,
actor, "rotation-angle-x", CLUTTER_LINEAR, 0.0,
actor, "rotation-angle-y", CLUTTER_LINEAR, 0.0,
NULL);
clutter_state_set (layout_state, NULL, "right",
actor, "delayed::x", CLUTTER_LINEAR, STAGE_WIDTH * 1.0,
((row*1.0/ROWS))/2,
(1.0-(row*1.0/ROWS))/2,
actor, "delayed::y", CLUTTER_LINEAR, STAGE_HEIGHT * 1.0,
((row*1.0/ROWS))/2,
0.0,
NULL);
clutter_state_set (layout_state, NULL, "left",
actor, "rotation-angle-x", CLUTTER_LINEAR, 45.0,
actor, "rotation-angle-y", CLUTTER_LINEAR, 5.0,
actor, "x", CLUTTER_LINEAR, 0-64.0,
actor, "y", CLUTTER_LINEAR, 0-64.0,
NULL);
a_state = clutter_state_new ();
g_object_set_data_full (G_OBJECT (actor), "hover-state-machine",
a_state, g_object_unref);
clutter_state_set (a_state, NULL, "normal",
actor, "opacity", CLUTTER_LINEAR, 0x77,
actor, "rotation-angle-z", CLUTTER_LINEAR, 0.0,
NULL);
clutter_state_set (a_state, NULL, "hover",
actor, "opacity", CLUTTER_LINEAR, 0xff,
actor, "rotation-angle-z", CLUTTER_LINEAR, 10.0,
NULL);
clutter_actor_set_opacity (actor, 0x77);
clutter_state_set_duration (a_state, NULL, NULL, 500);
}
clutter_state_set_duration (layout_state, NULL, NULL, 1000);
clutter_state_set_duration (layout_state, "active", "left", 1400);
g_signal_connect (layout_state, "completed", G_CALLBACK (completed), NULL);
clutter_actor_show (stage);
clutter_state_warp_to_state (layout_state, "left");
clutter_state_set_state (layout_state, "active");
clutter_perf_fps_start (CLUTTER_STAGE (stage));
clutter_main ();
clutter_perf_fps_report ("test-state-mini");
g_object_unref (layout_state);
return EXIT_SUCCESS;
}

Some files were not shown because too many files have changed in this diff Show More