Merge branch 'master' into msvc-support-master

This commit is contained in:
Chun-wei Fan 2011-11-14 22:57:50 +08:00
commit 96d4e527ea
135 changed files with 944 additions and 518 deletions

View File

@ -289,6 +289,12 @@ features).
Release Notes for Clutter 1.10 Release Notes for Clutter 1.10
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
• The "default stage" has been deprecated; since the 1.0 release, the default
stage creation was deferred to the call to clutter_stage_get_default(), and
the preferred way for getting a ClutterStage was calling clutter_stage_new()
instead. On platforms that do not support multiple stages, attempting to
create more than one stage will lead to an error, and Clutter will abort.
• Clutter can support multiple backends in the same shared library. Only one • Clutter can support multiple backends in the same shared library. Only one
windowing or input backend can be used at run time. As a result of this windowing or input backend can be used at run time. As a result of this
change, the shared library name used by Clutter has changed from: change, the shared library name used by Clutter has changed from:

View File

@ -551,15 +551,13 @@ cally_actor_ref_state_set (AtkObject *obj)
atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE); atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
stage = CLUTTER_STAGE (clutter_actor_get_stage (actor)); stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
/* If for any reason this actor doesn't have a stage if (stage != NULL)
associated, we try the default one as fallback */ {
if (stage == NULL)
stage = CLUTTER_STAGE (clutter_stage_get_default ());
focus_actor = clutter_stage_get_key_focus (stage); focus_actor = clutter_stage_get_key_focus (stage);
if (focus_actor == actor) if (focus_actor == actor)
atk_state_set_add_state (state_set, ATK_STATE_FOCUSED); atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
} }
}
return state_set; return state_set;
} }

View File

@ -12575,7 +12575,7 @@ _clutter_actor_foreach_child (ClutterActor *self,
/* For debugging purposes this gives us a simple way to print out /* For debugging purposes this gives us a simple way to print out
* the scenegraph e.g in gdb using: * the scenegraph e.g in gdb using:
* [| * [|
* _clutter_actor_traverse (clutter_stage_get_default (), * _clutter_actor_traverse (stage,
* 0, * 0,
* _clutter_debug_print_actor_cb, * _clutter_debug_print_actor_cb,
* NULL, * NULL,

View File

@ -684,14 +684,11 @@ _clutter_backend_create_stage (ClutterBackend *backend,
GError **error) GError **error)
{ {
ClutterBackendClass *klass; ClutterBackendClass *klass;
ClutterStageManager *stage_manager;
ClutterStageWindow *stage_window; ClutterStageWindow *stage_window;
g_assert (CLUTTER_IS_BACKEND (backend)); g_assert (CLUTTER_IS_BACKEND (backend));
g_assert (CLUTTER_IS_STAGE (wrapper)); g_assert (CLUTTER_IS_STAGE (wrapper));
stage_manager = clutter_stage_manager_get_default ();
klass = CLUTTER_BACKEND_GET_CLASS (backend); klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->create_stage != NULL) if (klass->create_stage != NULL)
stage_window = klass->create_stage (backend, wrapper, error); stage_window = klass->create_stage (backend, wrapper, error);
@ -702,8 +699,6 @@ _clutter_backend_create_stage (ClutterBackend *backend,
return NULL; return NULL;
g_assert (CLUTTER_IS_STAGE_WINDOW (stage_window)); g_assert (CLUTTER_IS_STAGE_WINDOW (stage_window));
_clutter_stage_set_window (wrapper, stage_window);
_clutter_stage_manager_add_stage (stage_manager, wrapper);
return stage_window; return stage_window;
} }

View File

@ -766,5 +766,5 @@ clutter_deform_effect_invalidate (ClutterDeformEffect *effect)
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect)); actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
if (actor != NULL) if (actor != NULL)
clutter_actor_queue_redraw (actor); clutter_effect_queue_repaint (CLUTTER_EFFECT (effect));
} }

View File

@ -43,6 +43,8 @@
#include "clutter-script-private.h" #include "clutter-script-private.h"
#include "clutter-scriptable.h" #include "clutter-scriptable.h"
#include "clutter-stage-manager.h"
#include "clutter-private.h" #include "clutter-private.h"
static void clutter_script_parser_object_end (JsonParser *parser, static void clutter_script_parser_object_end (JsonParser *parser,
@ -1966,7 +1968,9 @@ _clutter_script_construct_object (ClutterScript *script,
if (oinfo->is_stage && oinfo->is_stage_default) if (oinfo->is_stage && oinfo->is_stage_default)
{ {
ClutterStageManager *manager = clutter_stage_manager_get_default ();
GList *properties = oinfo->properties; GList *properties = oinfo->properties;
ClutterStage *default_stage;
/* the default stage is a complex beast: we cannot create it using /* the default stage is a complex beast: we cannot create it using
* g_object_newv() but we need clutter_script_construct_parameters() * g_object_newv() but we need clutter_script_construct_parameters()
@ -1981,7 +1985,8 @@ _clutter_script_construct_object (ClutterScript *script,
properties, properties,
&params); &params);
oinfo->object = G_OBJECT (clutter_stage_get_default ()); default_stage = clutter_stage_manager_get_default_stage (manager);
oinfo->object = G_OBJECT (default_stage);
for (i = 0; i < params->len; i++) for (i = 0; i < params->len; i++)
{ {

View File

@ -203,7 +203,7 @@ clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager,
{ {
} }
/* /*< private >
* _clutter_stage_manager_set_default_stage: * _clutter_stage_manager_set_default_stage:
* @stage_manager: a #ClutterStageManager * @stage_manager: a #ClutterStageManager
* @stage: a #ClutterStage * @stage: a #ClutterStage
@ -211,10 +211,6 @@ clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager,
* Sets @stage as the default stage * Sets @stage as the default stage
* *
* A no-op if there already is a default stage * A no-op if there already is a default stage
*
* This is called by clutter_stage_get_default() and should be removed
* along with #ClutterStageManager:default-stage when we stop having
* the default stage
*/ */
void void
_clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager, _clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager,
@ -224,6 +220,9 @@ _clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager,
{ {
default_stage = stage; default_stage = stage;
/* the default stage is immediately realized */
clutter_actor_realize (CLUTTER_ACTOR (stage));
g_object_notify (G_OBJECT (stage_manager), "default-stage"); g_object_notify (G_OBJECT (stage_manager), "default-stage");
} }
} }
@ -312,10 +311,9 @@ _clutter_stage_manager_remove_stage (ClutterStageManager *stage_manager,
stage_manager->stages = g_slist_remove (stage_manager->stages, stage); stage_manager->stages = g_slist_remove (stage_manager->stages, stage);
/* if it's the default stage, get the first available from the list */ /* if the default stage is being destroyed then we unset the pointer */
if (default_stage == stage) if (default_stage == stage)
default_stage = stage_manager->stages ? stage_manager->stages->data default_stage = NULL;
: NULL;
g_signal_emit (stage_manager, manager_signals[STAGE_REMOVED], 0, stage); g_signal_emit (stage_manager, manager_signals[STAGE_REMOVED], 0, stage);

View File

@ -30,11 +30,6 @@
* #ClutterStage is a top level 'window' on which child actors are placed * #ClutterStage is a top level 'window' on which child actors are placed
* and manipulated. * and manipulated.
* *
* Clutter creates a default stage upon initialization, which can be retrieved
* using clutter_stage_get_default(). Clutter always provides the default
* stage, unless the backend is unable to create one. The stage returned
* by clutter_stage_get_default() is guaranteed to always be the same.
*
* Backends might provide support for multiple stages. The support for this * Backends might provide support for multiple stages. The support for this
* feature can be checked at run-time using the clutter_feature_available() * feature can be checked at run-time using the clutter_feature_available()
* function and the %CLUTTER_FEATURE_STAGE_MULTIPLE flag. If the backend used * function and the %CLUTTER_FEATURE_STAGE_MULTIPLE flag. If the backend used
@ -281,6 +276,23 @@ queue_full_redraw (ClutterStage *stage)
_clutter_stage_window_add_redraw_clip (stage_window, NULL); _clutter_stage_window_add_redraw_clip (stage_window, NULL);
} }
static gboolean
stage_is_default (ClutterStage *stage)
{
ClutterStageManager *stage_manager;
ClutterStageWindow *impl;
stage_manager = clutter_stage_manager_get_default ();
if (stage != clutter_stage_manager_get_default_stage (stage_manager))
return FALSE;
impl = _clutter_stage_get_window (stage);
if (impl != _clutter_stage_get_default_window ())
return FALSE;
return TRUE;
}
static void static void
clutter_stage_allocate (ClutterActor *self, clutter_stage_allocate (ClutterActor *self,
const ClutterActorBox *box, const ClutterActorBox *box,
@ -1477,7 +1489,7 @@ static gboolean
clutter_stage_real_delete_event (ClutterStage *stage, clutter_stage_real_delete_event (ClutterStage *stage,
ClutterEvent *event) ClutterEvent *event)
{ {
if (clutter_stage_is_default (stage)) if (stage_is_default (stage))
clutter_main_quit (); clutter_main_quit ();
else else
clutter_actor_destroy (CLUTTER_ACTOR (stage)); clutter_actor_destroy (CLUTTER_ACTOR (stage));
@ -1497,6 +1509,39 @@ clutter_stage_real_apply_transform (ClutterActor *stage,
cogl_matrix_multiply (matrix, matrix, &priv->view); cogl_matrix_multiply (matrix, matrix, &priv->view);
} }
static void
clutter_stage_constructed (GObject *gobject)
{
ClutterStage *self = CLUTTER_STAGE (gobject);
ClutterStageManager *stage_manager;
stage_manager = clutter_stage_manager_get_default ();
/* this will take care to sinking the floating reference */
_clutter_stage_manager_add_stage (stage_manager, self);
/* if this stage has been created on a backend that does not
* support multiple stages then it becomes the default stage
* as well; any other attempt at creating a ClutterStage will
* fail.
*/
if (!clutter_feature_available (CLUTTER_FEATURE_STAGE_MULTIPLE))
{
if (G_UNLIKELY (clutter_stage_manager_get_default_stage (stage_manager) != NULL))
{
g_error ("Unable to create another stage: the backend of "
"type '%s' does not support multiple stages. Use "
"clutter_stage_manager_get_default_stage() instead "
"to access the stage singleton.",
G_OBJECT_TYPE_NAME (clutter_get_default_backend ()));
}
_clutter_stage_manager_set_default_stage (stage_manager, self);
}
G_OBJECT_CLASS (clutter_stage_parent_class)->constructed (gobject);
}
static void static void
clutter_stage_set_property (GObject *object, clutter_stage_set_property (GObject *object,
guint prop_id, guint prop_id,
@ -1647,6 +1692,10 @@ clutter_stage_dispose (GObject *object)
clutter_actor_hide (CLUTTER_ACTOR (object)); clutter_actor_hide (CLUTTER_ACTOR (object));
/* remove_stage() will unref() the stage instance, so we need to
* add a reference here to keep it temporarily alive
*/
g_object_ref (object);
stage_manager = clutter_stage_manager_get_default (); stage_manager = clutter_stage_manager_get_default ();
_clutter_stage_manager_remove_stage (stage_manager, stage); _clutter_stage_manager_remove_stage (stage_manager, stage);
@ -1696,6 +1745,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GParamSpec *pspec; GParamSpec *pspec;
gobject_class->constructed = clutter_stage_constructed;
gobject_class->set_property = clutter_stage_set_property; gobject_class->set_property = clutter_stage_set_property;
gobject_class->get_property = clutter_stage_get_property; gobject_class->get_property = clutter_stage_get_property;
gobject_class->dispose = clutter_stage_dispose; gobject_class->dispose = clutter_stage_dispose;
@ -2036,9 +2086,11 @@ clutter_stage_notify_min_size (ClutterStage *self)
static void static void
clutter_stage_init (ClutterStage *self) clutter_stage_init (ClutterStage *self)
{ {
cairo_rectangle_int_t geom = { 0, };
ClutterStagePrivate *priv; ClutterStagePrivate *priv;
ClutterStageWindow *impl;
ClutterBackend *backend; ClutterBackend *backend;
cairo_rectangle_int_t geom; GError *error;
/* a stage is a top-level object */ /* a stage is a top-level object */
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IS_TOPLEVEL); CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IS_TOPLEVEL);
@ -2047,15 +2099,25 @@ clutter_stage_init (ClutterStage *self)
CLUTTER_NOTE (BACKEND, "Creating stage from the default backend"); CLUTTER_NOTE (BACKEND, "Creating stage from the default backend");
backend = clutter_get_default_backend (); backend = clutter_get_default_backend ();
priv->impl = _clutter_backend_create_stage (backend, self, NULL);
if (!priv->impl)
{
g_warning ("Unable to create a new stage, falling back to the "
"default stage.");
priv->impl = _clutter_stage_get_default_window ();
/* at this point we must have a default stage, or we're screwed */ error = NULL;
g_assert (priv->impl != NULL); impl = _clutter_backend_create_stage (backend, self, &error);
if (G_LIKELY (impl != NULL))
{
_clutter_stage_set_window (self, impl);
_clutter_stage_window_get_geometry (priv->impl, &geom);
}
else
{
if (error != NULL)
{
g_critical ("Unable to create a new stage implementation: %s",
error->message);
g_error_free (error);
}
else
g_critical ("Unable to create a new stage implementation.");
} }
priv->event_queue = g_queue_new (); priv->event_queue = g_queue_new ();
@ -2077,8 +2139,6 @@ clutter_stage_init (ClutterStage *self)
priv->color = default_stage_color; priv->color = default_stage_color;
_clutter_stage_window_get_geometry (priv->impl, &geom);
priv->perspective.fovy = 60.0; /* 60 Degrees */ priv->perspective.fovy = 60.0; /* 60 Degrees */
priv->perspective.aspect = (float) geom.width / (float) geom.height; priv->perspective.aspect = (float) geom.width / (float) geom.height;
priv->perspective.z_near = 0.1; priv->perspective.z_near = 0.1;
@ -2133,16 +2193,29 @@ clutter_stage_init (ClutterStage *self)
/** /**
* clutter_stage_get_default: * clutter_stage_get_default:
* *
* Returns the main stage. The default #ClutterStage is a singleton, * Retrieves a #ClutterStage singleton.
* so the stage will be created the first time this function is
* called (typically, inside clutter_init()); all the subsequent
* calls to clutter_stage_get_default() will return the same instance.
* *
* Clutter guarantess the existence of the default stage. * This function is not as useful as it sounds, and will most likely
* by deprecated in the future. Application code should only create
* a #ClutterStage instance using clutter_stage_new(), and manage the
* lifetime of the stage manually.
*
* The default stage singleton has a platform-specific behaviour: on
* platforms without the %CLUTTER_FEATURE_STAGE_MULTIPLE feature flag
* set, the first #ClutterStage instance will also be set to be the
* default stage instance, and this function will always return a
* pointer to it.
*
* On platforms with the %CLUTTER_FEATURE_STAGE_MULTIPLE feature flag
* set, the default stage will be created by the first call to this
* function, and every following call will return the same pointer to
* it.
* *
* Return value: (transfer none) (type Clutter.Stage): the main * Return value: (transfer none) (type Clutter.Stage): the main
* #ClutterStage. You should never destroy or unref the returned * #ClutterStage. You should never destroy or unref the returned
* actor. * actor.
*
* Deprecated: 1.10: Use clutter_stage_new() instead.
*/ */
ClutterActor * ClutterActor *
clutter_stage_get_default (void) clutter_stage_get_default (void)
@ -3149,16 +3222,6 @@ G_DEFINE_BOXED_TYPE (ClutterFog, clutter_fog, clutter_fog_copy, clutter_fog_free
ClutterActor * ClutterActor *
clutter_stage_new (void) clutter_stage_new (void)
{ {
if (!clutter_feature_available (CLUTTER_FEATURE_STAGE_MULTIPLE))
{
g_warning ("Unable to create a new stage: the %s backend does not "
"support multiple stages.",
CLUTTER_FLAVOUR);
return NULL;
}
/* The stage manager will grab the floating reference when the stage
is added to it in the constructor */
return g_object_new (CLUTTER_TYPE_STAGE, NULL); return g_object_new (CLUTTER_TYPE_STAGE, NULL);
} }
@ -3430,10 +3493,9 @@ clutter_stage_ensure_redraw (ClutterStage *stage)
* <note>Applications should call clutter_actor_queue_redraw() and not * <note>Applications should call clutter_actor_queue_redraw() and not
* this function.</note> * this function.</note>
* *
* <note>This function is just a wrapper for clutter_actor_queue_redraw()
* and should probably go away.</note>
*
* Since: 0.8 * Since: 0.8
*
* Deprecated: 1.10: Use clutter_actor_queue_redraw() instead.
*/ */
void void
clutter_stage_queue_redraw (ClutterStage *stage) clutter_stage_queue_redraw (ClutterStage *stage)
@ -3453,24 +3515,17 @@ clutter_stage_queue_redraw (ClutterStage *stage)
* Return value: %TRUE if the passed stage is the default one * Return value: %TRUE if the passed stage is the default one
* *
* Since: 0.8 * Since: 0.8
*
* Deprecated: 1.10: Track the stage pointer inside your application
* code, or use clutter_actor_get_stage() to retrieve the stage for
* a given actor.
*/ */
gboolean gboolean
clutter_stage_is_default (ClutterStage *stage) clutter_stage_is_default (ClutterStage *stage)
{ {
ClutterStageManager *stage_manager;
ClutterStageWindow *impl;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE); g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
stage_manager = clutter_stage_manager_get_default (); return stage_is_default (stage);
if (stage != clutter_stage_manager_get_default_stage (stage_manager))
return FALSE;
impl = _clutter_stage_get_window (stage);
if (impl != _clutter_stage_get_default_window ())
return FALSE;
return TRUE;
} }
void void
@ -3480,7 +3535,7 @@ _clutter_stage_set_window (ClutterStage *stage,
g_return_if_fail (CLUTTER_IS_STAGE (stage)); g_return_if_fail (CLUTTER_IS_STAGE (stage));
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (stage_window)); g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (stage_window));
if (stage->priv->impl) if (stage->priv->impl != NULL)
g_object_unref (stage->priv->impl); g_object_unref (stage->priv->impl);
stage->priv->impl = stage_window; stage->priv->impl = stage_window;
@ -3497,9 +3552,14 @@ _clutter_stage_get_window (ClutterStage *stage)
ClutterStageWindow * ClutterStageWindow *
_clutter_stage_get_default_window (void) _clutter_stage_get_default_window (void)
{ {
ClutterActor *stage = clutter_stage_get_default (); ClutterStageManager *manager = clutter_stage_manager_get_default ();
ClutterStage *stage;
return _clutter_stage_get_window (CLUTTER_STAGE (stage)); stage = clutter_stage_manager_get_default_stage (manager);
if (stage == NULL)
return NULL;
return _clutter_stage_get_window (stage);
} }
/** /**

View File

@ -146,7 +146,6 @@ GType clutter_perspective_get_type (void) G_GNUC_CONST;
GType clutter_fog_get_type (void) G_GNUC_CONST; GType clutter_fog_get_type (void) G_GNUC_CONST;
GType clutter_stage_get_type (void) G_GNUC_CONST; GType clutter_stage_get_type (void) G_GNUC_CONST;
ClutterActor *clutter_stage_get_default (void);
ClutterActor *clutter_stage_new (void); ClutterActor *clutter_stage_new (void);
void clutter_stage_set_color (ClutterStage *stage, void clutter_stage_set_color (ClutterStage *stage,
@ -193,8 +192,6 @@ void clutter_stage_set_key_focus (ClutterStage *stage,
ClutterActor *actor); ClutterActor *actor);
ClutterActor * clutter_stage_get_key_focus (ClutterStage *stage); ClutterActor * clutter_stage_get_key_focus (ClutterStage *stage);
void clutter_stage_ensure_current (ClutterStage *stage); void clutter_stage_ensure_current (ClutterStage *stage);
void clutter_stage_queue_redraw (ClutterStage *stage);
gboolean clutter_stage_is_default (ClutterStage *stage);
void clutter_stage_ensure_viewport (ClutterStage *stage); void clutter_stage_ensure_viewport (ClutterStage *stage);
void clutter_stage_ensure_redraw (ClutterStage *stage); void clutter_stage_ensure_redraw (ClutterStage *stage);

View File

@ -40,6 +40,15 @@ G_BEGIN_DECLS
#endif /* CLUTTER_DISABLE_DEPRECATED */ #endif /* CLUTTER_DISABLE_DEPRECATED */
CLUTTER_DEPRECATED_FOR(clutter_stage_new)
ClutterActor * clutter_stage_get_default (void);
CLUTTER_DEPRECATED
gboolean clutter_stage_is_default (ClutterStage *stage);
CLUTTER_DEPRECATED_FOR(clutter_actor_queue_redraw)
void clutter_stage_queue_redraw (ClutterStage *stage);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_STAGE_DEPRECATED_H__ */ #endif /* __CLUTTER_STAGE_DEPRECATED_H__ */

View File

@ -44,6 +44,7 @@
#include "clutter-input-device-evdev.h" #include "clutter-input-device-evdev.h"
#include "clutter-main.h" #include "clutter-main.h"
#include "clutter-private.h" #include "clutter-private.h"
#include "clutter-stage-manager.h"
#include "clutter-xkb-utils.h" #include "clutter-xkb-utils.h"
#include "clutter-device-manager-evdev.h" #include "clutter-device-manager-evdev.h"
@ -268,9 +269,14 @@ clutter_event_dispatch (GSource *g_source,
ClutterEvent *event; ClutterEvent *event;
gint len, i, dx = 0, dy = 0; gint len, i, dx = 0, dy = 0;
uint32_t _time; uint32_t _time;
ClutterStageManager *stage_manager;
ClutterStage *default_stage;
clutter_threads_enter (); clutter_threads_enter ();
stage_manager = clutter_stage_manager_get_default ();
default_stage = clutter_stage_manager_get_default_stage (stage_manager);
/* Don't queue more events if we haven't finished handling the previous batch /* Don't queue more events if we haven't finished handling the previous batch
*/ */
if (!clutter_events_pending ()) if (!clutter_events_pending ())
@ -303,6 +309,10 @@ clutter_event_dispatch (GSource *g_source,
goto out; goto out;
} }
/* Drop events if we don't have any stage to forward them to */
if (!default_stage)
goto out;
for (i = 0; i < len / sizeof (ev[0]); i++) for (i = 0; i < len / sizeof (ev[0]); i++)
{ {
struct input_event *e = &ev[i]; struct input_event *e = &ev[i];
@ -530,7 +540,6 @@ evdev_add_device (ClutterDeviceManagerEvdev *manager_evdev,
ClutterDeviceManager *manager = (ClutterDeviceManager *) manager_evdev; ClutterDeviceManager *manager = (ClutterDeviceManager *) manager_evdev;
ClutterInputDeviceType type = CLUTTER_EXTENSION_DEVICE; ClutterInputDeviceType type = CLUTTER_EXTENSION_DEVICE;
ClutterInputDevice *device; ClutterInputDevice *device;
ClutterActor *stage;
const gchar *device_file, *sysfs_path, *device_name; const gchar *device_file, *sysfs_path, *device_name;
device_file = g_udev_device_get_device_file (udev_device); device_file = g_udev_device_get_device_file (udev_device);
@ -573,10 +582,6 @@ evdev_add_device (ClutterDeviceManagerEvdev *manager_evdev,
"enabled", TRUE, "enabled", TRUE,
NULL); NULL);
/* Always associate the device to the default stage */
stage = clutter_stage_get_default ();
_clutter_input_device_set_stage (device, CLUTTER_STAGE (stage));
_clutter_device_manager_add_device (manager, device); _clutter_device_manager_add_device (manager, device);
CLUTTER_NOTE (EVENT, "Added device %s, type %d, sysfs %s", CLUTTER_NOTE (EVENT, "Added device %s, type %d, sysfs %s",

View File

@ -29,7 +29,7 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 300, 200); clutter_actor_set_size (stage, 300, 200);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -39,7 +39,7 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 300, 200); clutter_actor_set_size (stage, 300, 200);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -40,7 +40,7 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 300, 200); clutter_actor_set_size (stage, 300, 200);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -79,7 +79,7 @@ if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
state->animator = clutter_animator_new (); state->animator = clutter_animator_new ();
clutter_animator_set_duration (state->animator, 500); clutter_animator_set_duration (state->animator, 500);
state->stage = clutter_stage_get_default (); state->stage = clutter_stage_new ();
clutter_actor_set_size (state->stage, 400, 350); clutter_actor_set_size (state->stage, 400, 350);
clutter_stage_set_color (CLUTTER_STAGE (state->stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (state->stage), &stage_color);
g_signal_connect (state->stage, g_signal_connect (state->stage,

View File

@ -47,7 +47,7 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 500, 500); clutter_actor_set_size (stage, 500, 500);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -30,7 +30,7 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 650, 500); clutter_actor_set_size (stage, 650, 500);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -42,7 +42,7 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
texture = clutter_texture_new (); texture = clutter_texture_new ();

View File

@ -109,7 +109,7 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE); clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -117,7 +117,7 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 350, 350); clutter_actor_set_size (stage, 350, 350);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -26,7 +26,7 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400); clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -125,7 +125,7 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 320, 240); clutter_actor_set_size (stage, 320, 240);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -60,7 +60,7 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400); clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -78,8 +78,9 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT); clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* the scrollable actor */ /* the scrollable actor */
texture = clutter_texture_new (); texture = clutter_texture_new ();

View File

@ -37,7 +37,7 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_stage_set_title (CLUTTER_STAGE (stage), "btn"); clutter_stage_set_title (CLUTTER_STAGE (stage), "btn");

View File

@ -115,9 +115,10 @@ main (int argc, char *argv[])
cogl_path_new (); cogl_path_new ();
context->cogl_path = cogl_get_path (); context->cogl_path = cogl_get_path ();
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400); clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
rect = clutter_rectangle_new_with_color (&actor_color); rect = clutter_rectangle_new_with_color (&actor_color);
clutter_actor_set_size (rect, 300, 300); clutter_actor_set_size (rect, 300, 300);

View File

@ -53,9 +53,10 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 300, 300); clutter_actor_set_size (stage, 300, 300);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
r1 = clutter_rectangle_new_with_color (&red); r1 = clutter_rectangle_new_with_color (&red);
clutter_actor_set_size (r1, 150, 150); clutter_actor_set_size (r1, 150, 150);

View File

@ -32,9 +32,10 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400); clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
rectangle = clutter_rectangle_new_with_color (&rectangle_color); rectangle = clutter_rectangle_new_with_color (&rectangle_color);
clutter_actor_set_size (rectangle, 300, 300); clutter_actor_set_size (rectangle, 300, 300);

View File

@ -38,7 +38,7 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400); clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -91,7 +91,7 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400); clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -322,7 +322,7 @@ main (int argc,
state->expand = FALSE; state->expand = FALSE;
state->x_align = CLUTTER_BOX_ALIGNMENT_START; state->x_align = CLUTTER_BOX_ALIGNMENT_START;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE); clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -21,7 +21,7 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400); clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -17,8 +17,9 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400); clutter_actor_set_size (stage, 400, 400);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_START, layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_START,
CLUTTER_BIN_ALIGNMENT_START); CLUTTER_BIN_ALIGNMENT_START);

View File

@ -28,8 +28,9 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE); clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
CLUTTER_BIN_ALIGNMENT_CENTER); CLUTTER_BIN_ALIGNMENT_CENTER);

View File

@ -149,7 +149,7 @@ main (int argc, char *argv[])
* assign the material we created earlier to the Texture for painting * assign the material we created earlier to the Texture for painting
* it * it
*/ */
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "cross-fade"); clutter_stage_set_title (CLUTTER_STAGE (stage), "cross-fade");
clutter_actor_set_size (stage, 400, 300); clutter_actor_set_size (stage, 400, 300);
clutter_actor_show (stage); clutter_actor_show (stage);

View File

@ -125,7 +125,7 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
clutter_stage_set_title (CLUTTER_STAGE (stage), "cross-fade"); clutter_stage_set_title (CLUTTER_STAGE (stage), "cross-fade");
clutter_actor_set_size (stage, stage_side, stage_side); clutter_actor_set_size (stage, stage_side, stage_side);

View File

@ -85,7 +85,7 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "cross-fade"); clutter_stage_set_title (CLUTTER_STAGE (stage), "cross-fade");
clutter_actor_set_size (stage, 400, 300); clutter_actor_set_size (stage, 400, 300);
clutter_actor_show (stage); clutter_actor_show (stage);

View File

@ -117,9 +117,10 @@ main (int argc,
if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS) if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_get_size (stage, &stage_width, &stage_height); clutter_actor_get_size (stage, &stage_width, &stage_height);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Animate sub-textures"); clutter_stage_set_title (CLUTTER_STAGE (stage), "Animate sub-textures");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Load smiley.png, creating a new ClutterTexture, get its size and the /* Load smiley.png, creating a new ClutterTexture, get its size and the
* Cogl texture handle */ * Cogl texture handle */

View File

@ -12,8 +12,9 @@ main (int argc, char **argv)
return 1; return 1;
/* Get the default stage */ /* Get the default stage */
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Sub-texture"); clutter_stage_set_title (CLUTTER_STAGE (stage), "Sub-texture");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Create a new ClutterTexture that shows smiley.png */ /* Create a new ClutterTexture that shows smiley.png */
image = clutter_texture_new_from_file ("smiley.png", NULL); image = clutter_texture_new_from_file ("smiley.png", NULL);

View File

@ -302,7 +302,8 @@ main (int argc, char *argv[])
if (clutter_init (&amp;argc, &amp;argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&amp;argc, &amp;argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
actor = clutter_texture_new_from_file ("ohpowers.png", NULL); actor = clutter_texture_new_from_file ("ohpowers.png", NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor); clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);

View File

@ -45,11 +45,14 @@ main (int argc, char *argv[])
cally_util_a11y_init (&argc, &argv); cally_util_a11y_init (&argc, &argv);
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cally - AtkComponent Test");
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_White); clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_White);
clutter_actor_set_size (stage, WIDTH, HEIGHT); clutter_actor_set_size (stage, WIDTH, HEIGHT);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
button1 = clutter_rectangle_new_with_color (CLUTTER_COLOR_Yellow); button1 = clutter_rectangle_new_with_color (CLUTTER_COLOR_Yellow);
clutter_actor_set_size (button1, SIZE, SIZE); clutter_actor_set_size (button1, SIZE, SIZE);

View File

@ -148,15 +148,14 @@ _create_button (const gchar *text)
ClutterActor *button = NULL; ClutterActor *button = NULL;
ClutterActor *rectangle = NULL; ClutterActor *rectangle = NULL;
ClutterActor *label = NULL; ClutterActor *label = NULL;
ClutterColor color_rect = { 0x00, 0xff, 0xff, 0xff };
ClutterColor color_label = { 0x00, 0x00, 0x00, 0xff };
button = clutter_group_new (); button = clutter_group_new ();
rectangle = clutter_rectangle_new_with_color (&color_rect); rectangle = clutter_rectangle_new_with_color (CLUTTER_COLOR_Magenta);
clutter_actor_set_size (rectangle, 375, 35); clutter_actor_set_size (rectangle, 375, 35);
label = clutter_text_new_full ("Sans Bold 32px", label = clutter_text_new_full ("Sans Bold 32px",
text, &color_label); text,
CLUTTER_COLOR_Black);
clutter_container_add_actor (CLUTTER_CONTAINER (button), rectangle); clutter_container_add_actor (CLUTTER_CONTAINER (button), rectangle);
clutter_container_add_actor (CLUTTER_CONTAINER (button), label); clutter_container_add_actor (CLUTTER_CONTAINER (button), label);
clutter_actor_set_reactive (button, TRUE); clutter_actor_set_reactive (button, TRUE);
@ -164,33 +163,30 @@ _create_button (const gchar *text)
return button; return button;
} }
static void static void
make_ui (ClutterActor *stage) make_ui (ClutterActor *stage)
{ {
ClutterColor color_stage = { 0x00, 0x00, 0x00, 0xff };
ClutterColor color_text = { 0xff, 0x00, 0x00, 0xff };
ClutterColor color_sel = { 0x00, 0xff, 0x00, 0x55 };
ClutterActor *button = NULL; ClutterActor *button = NULL;
clutter_stage_set_color (CLUTTER_STAGE (stage), &color_stage); clutter_stage_set_title (CLUTTER_STAGE (stage), "Cally - AtkEditable Test");
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_White);
clutter_actor_set_size (stage, WIDTH, HEIGHT); clutter_actor_set_size (stage, WIDTH, HEIGHT);
/* text */ /* text */
text_actor = clutter_text_new_full ("Sans Bold 32px", text_actor = clutter_text_new_full ("Sans Bold 32px",
"Lorem ipsum dolor sit amet", "Lorem ipsum dolor sit amet",
&color_text); CLUTTER_COLOR_Red);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), text_actor); clutter_container_add_actor (CLUTTER_CONTAINER (stage), text_actor);
/* text_editable */ /* text_editable */
text_editable_actor = clutter_text_new_full ("Sans Bold 32px", text_editable_actor = clutter_text_new_full ("Sans Bold 32px",
"consectetur adipisicing elit", "consectetur adipisicing elit",
&color_text); CLUTTER_COLOR_Red);
clutter_actor_set_position (text_editable_actor, 0, 100); clutter_actor_set_position (text_editable_actor, 0, 100);
clutter_text_set_editable (CLUTTER_TEXT (text_editable_actor), TRUE); clutter_text_set_editable (CLUTTER_TEXT (text_editable_actor), TRUE);
clutter_text_set_selectable (CLUTTER_TEXT (text_editable_actor), TRUE); clutter_text_set_selectable (CLUTTER_TEXT (text_editable_actor), TRUE);
clutter_text_set_selection_color (CLUTTER_TEXT (text_editable_actor), clutter_text_set_selection_color (CLUTTER_TEXT (text_editable_actor),
&color_sel); CLUTTER_COLOR_Green);
clutter_text_set_activatable (CLUTTER_TEXT (text_editable_actor), clutter_text_set_activatable (CLUTTER_TEXT (text_editable_actor),
TRUE); TRUE);
clutter_text_set_line_wrap (CLUTTER_TEXT (text_editable_actor), TRUE); clutter_text_set_line_wrap (CLUTTER_TEXT (text_editable_actor), TRUE);
@ -256,7 +252,8 @@ main (int argc, char *argv[])
cally_util_a11y_init (&argc, &argv); cally_util_a11y_init (&argc, &argv);
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
make_ui (stage); make_ui (stage);

View File

@ -88,7 +88,6 @@ make_ui (ClutterActor *stage)
ClutterActor *editable = NULL; ClutterActor *editable = NULL;
ClutterActor *rectangle = NULL; ClutterActor *rectangle = NULL;
ClutterActor *label = NULL; ClutterActor *label = NULL;
ClutterColor color_text = { 0xff, 0x00, 0x00, 0xff };
ClutterColor color_sel = { 0x00, 0xff, 0x00, 0x55 }; ClutterColor color_sel = { 0x00, 0xff, 0x00, 0x55 };
ClutterColor color_label = { 0x00, 0xff, 0x55, 0xff }; ClutterColor color_label = { 0x00, 0xff, 0x55, 0xff };
ClutterColor color_rect = { 0x00, 0xff, 0xff, 0x55 }; ClutterColor color_rect = { 0x00, 0xff, 0xff, 0x55 };
@ -111,7 +110,7 @@ make_ui (ClutterActor *stage)
/* editable */ /* editable */
editable = clutter_text_new_full ("Sans Bold 32px", editable = clutter_text_new_full ("Sans Bold 32px",
"ddd", "ddd",
&color_text); CLUTTER_COLOR_Red);
clutter_actor_set_position (editable, 150, editable_geom_y); clutter_actor_set_position (editable, 150, editable_geom_y);
clutter_actor_set_size (editable, 500, 75); clutter_actor_set_size (editable, 500, 75);
clutter_text_set_editable (CLUTTER_TEXT (editable), TRUE); clutter_text_set_editable (CLUTTER_TEXT (editable), TRUE);
@ -138,7 +137,7 @@ make_ui (ClutterActor *stage)
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
ClutterActor *stage = NULL; ClutterActor *stage, *stage_main;
Data data1, data2, data3; Data data1, data2, data3;
guint id_2 = 0; guint id_2 = 0;
@ -171,14 +170,19 @@ main (int argc, char *argv[])
atk_add_global_event_listener (window_event_listener, "Atk:AtkWindow:activate"); atk_add_global_event_listener (window_event_listener, "Atk:AtkWindow:activate");
atk_add_global_event_listener (window_event_listener, "Atk:AtkWindow:deactivate"); atk_add_global_event_listener (window_event_listener, "Atk:AtkWindow:deactivate");
stage = clutter_stage_get_default (); stage_main = clutter_stage_new ();
make_ui (stage); clutter_stage_set_title (CLUTTER_STAGE (stage_main), "Cally - AtkEvents/1");
g_signal_connect (stage_main, "destroy", G_CALLBACK (clutter_main_quit), NULL);
make_ui (stage_main);
clutter_actor_show_all (stage); clutter_actor_show_all (stage_main);
if (clutter_feature_available (CLUTTER_FEATURE_STAGE_MULTIPLE)) if (clutter_feature_available (CLUTTER_FEATURE_STAGE_MULTIPLE))
{ {
stage = clutter_stage_new (); stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cally - AtkEvents/2");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
make_ui (stage); make_ui (stage);
clutter_actor_show_all (stage); clutter_actor_show_all (stage);
} }

View File

@ -237,13 +237,12 @@ make_ui (ClutterActor *stage)
G_CALLBACK (button_press_cb), NULL); G_CALLBACK (button_press_cb), NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button); clutter_container_add_actor (CLUTTER_CONTAINER (stage), button);
} }
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
ClutterActor *stage = NULL; ClutterActor *stage;
g_set_application_name ("AtkText"); g_set_application_name ("AtkText");
@ -252,7 +251,9 @@ main (int argc, char *argv[])
cally_util_a11y_init (&argc, &argv); cally_util_a11y_init (&argc, &argv);
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cally - AtkText Test");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
make_ui (stage); make_ui (stage);

View File

@ -93,7 +93,7 @@ make_ui (ClutterActor *stage)
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
ClutterActor *stage = NULL; ClutterActor *stage;
g_set_application_name ("Clone Example"); g_set_application_name ("Clone Example");
@ -102,7 +102,10 @@ main (int argc, char *argv[])
cally_util_a11y_init (&argc, &argv); cally_util_a11y_init (&argc, &argv);
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cally - Clone Test");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
make_ui (stage); make_ui (stage);
clutter_actor_show_all (stage); clutter_actor_show_all (stage);

View File

@ -44,7 +44,7 @@ test_realized (TestConformSimpleFixture *fixture,
ClutterActor *actor; ClutterActor *actor;
ClutterActor *stage; ClutterActor *stage;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
actor = clutter_rectangle_new (); actor = clutter_rectangle_new ();
@ -60,7 +60,7 @@ test_realized (TestConformSimpleFixture *fixture,
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor))); g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor))); g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor)));
clutter_actor_destroy (actor); clutter_actor_destroy (stage);
} }
void void
@ -70,7 +70,7 @@ test_mapped (TestConformSimpleFixture *fixture,
ClutterActor *actor; ClutterActor *actor;
ClutterActor *stage; ClutterActor *stage;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_show (stage); clutter_actor_show (stage);
actor = clutter_rectangle_new (); actor = clutter_rectangle_new ();
@ -85,8 +85,7 @@ test_mapped (TestConformSimpleFixture *fixture,
g_assert (CLUTTER_ACTOR_IS_MAPPED (actor)); g_assert (CLUTTER_ACTOR_IS_MAPPED (actor));
g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor)); g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor));
clutter_actor_destroy (actor); clutter_actor_destroy (stage);
clutter_actor_hide (stage);
} }
void void
@ -96,7 +95,7 @@ test_realize_not_recursive (TestConformSimpleFixture *fixture,
ClutterActor *actor, *group; ClutterActor *actor, *group;
ClutterActor *stage; ClutterActor *stage;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_show (stage); clutter_actor_show (stage);
group = clutter_group_new (); group = clutter_group_new ();
@ -126,8 +125,7 @@ test_realize_not_recursive (TestConformSimpleFixture *fixture,
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor))); g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor))); g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor)));
clutter_actor_destroy (group); clutter_actor_destroy (stage);
clutter_actor_hide (stage);
} }
void void
@ -137,7 +135,7 @@ test_map_recursive (TestConformSimpleFixture *fixture,
ClutterActor *actor, *group; ClutterActor *actor, *group;
ClutterActor *stage; ClutterActor *stage;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_show (stage); clutter_actor_show (stage);
group = clutter_group_new (); group = clutter_group_new ();
@ -177,8 +175,7 @@ test_map_recursive (TestConformSimpleFixture *fixture,
g_assert (CLUTTER_ACTOR_IS_VISIBLE (group)); g_assert (CLUTTER_ACTOR_IS_VISIBLE (group));
g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor)); g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor));
clutter_actor_destroy (group); clutter_actor_destroy (stage);
clutter_actor_hide (stage);
} }
void void
@ -189,7 +186,7 @@ test_show_on_set_parent (TestConformSimpleFixture *fixture,
gboolean show_on_set_parent; gboolean show_on_set_parent;
ClutterActor *stage; ClutterActor *stage;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
group = clutter_group_new (); group = clutter_group_new ();
@ -227,6 +224,7 @@ test_show_on_set_parent (TestConformSimpleFixture *fixture,
clutter_actor_destroy (actor); clutter_actor_destroy (actor);
clutter_actor_destroy (group); clutter_actor_destroy (group);
clutter_actor_destroy (stage);
} }
void void
@ -238,7 +236,7 @@ test_clone_no_map (TestConformSimpleFixture *fixture,
ClutterActor *actor; ClutterActor *actor;
ClutterActor *clone; ClutterActor *clone;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_show (stage); clutter_actor_show (stage);
group = clutter_group_new (); group = clutter_group_new ();
@ -262,8 +260,7 @@ test_clone_no_map (TestConformSimpleFixture *fixture,
clutter_actor_destroy (CLUTTER_ACTOR (clone)); clutter_actor_destroy (CLUTTER_ACTOR (clone));
clutter_actor_destroy (CLUTTER_ACTOR (group)); clutter_actor_destroy (CLUTTER_ACTOR (group));
clutter_actor_destroy (stage);
clutter_actor_hide (stage);
} }
void void
@ -331,3 +328,20 @@ test_contains (TestConformSimpleFixture *fixture,
==, ==,
expected_results[x * 10 + y]); expected_results[x * 10 + y]);
} }
void
default_stage (TestConformSimpleFixture *fixture,
gconstpointer data)
{
ClutterActor *stage, *def_stage;
stage = clutter_stage_new ();
def_stage = clutter_stage_get_default ();
if (clutter_feature_available (CLUTTER_FEATURE_STAGE_MULTIPLE))
g_assert (stage != def_stage);
else
g_assert (stage == def_stage);
g_assert (CLUTTER_ACTOR_IS_REALIZED (def_stage));
}

View File

@ -677,7 +677,7 @@ actor_anchors (void)
TestState state; TestState state;
ClutterActor *stage; ClutterActor *stage;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
state.rect = clutter_rectangle_new (); state.rect = clutter_rectangle_new ();
clutter_container_add (CLUTTER_CONTAINER (stage), state.rect, NULL); clutter_container_add (CLUTTER_CONTAINER (stage), state.rect, NULL);
@ -699,6 +699,6 @@ actor_anchors (void)
g_idle_remove_by_data (&state); g_idle_remove_by_data (&state);
clutter_actor_destroy (state.rect); clutter_actor_destroy (stage);
} }

View File

@ -279,7 +279,7 @@ cally_text (void)
memset (&data, 0, sizeof (data)); memset (&data, 0, sizeof (data));
data.stage = clutter_stage_get_default (); data.stage = clutter_stage_new ();
data.default_attributes = default_attributes; data.default_attributes = default_attributes;
data.run_attributes = build_attribute_set ("fg-color", "0,0,0", NULL); data.run_attributes = build_attribute_set ("fg-color", "0,0,0", NULL);
@ -294,9 +294,8 @@ cally_text (void)
data.extents_height = 17; data.extents_height = 17;
clutter_actor_set_position (data.label, 20, 100); clutter_actor_set_position (data.label, 20, 100);
memset (&data1, 0, sizeof (data1)); memset (&data1, 0, sizeof (data1));
data1.stage = clutter_stage_get_default (); data1.stage = data.stage;
data1.default_attributes = default_attributes; data1.default_attributes = default_attributes;
data1.run_attributes = build_attribute_set ("bg-color", "0,65535,0", data1.run_attributes = build_attribute_set ("bg-color", "0,65535,0",
"fg-color", "65535,65535,0", "fg-color", "65535,65535,0",
@ -314,11 +313,12 @@ cally_text (void)
clutter_actor_set_position (data1.label, 20, 200); clutter_actor_set_position (data1.label, 20, 200);
data.next = &data1; data.next = &data1;
clutter_actor_show (data.stage); clutter_actor_show (data.stage);
clutter_threads_add_idle ((GSourceFunc) do_tests, &data); clutter_threads_add_idle ((GSourceFunc) do_tests, &data);
clutter_main (); clutter_main ();
clutter_actor_destroy (data.stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("\nOverall result: "); g_print ("\nOverall result: ");

View File

@ -169,7 +169,7 @@ test_clutter_cairo_texture (TestConformSimpleFixture *fixture,
unsigned int paint_handler; unsigned int paint_handler;
state.frame = 0; state.frame = 0;
state.stage = clutter_stage_get_default (); state.stage = clutter_stage_new ();
state.progress = TEST_BEFORE_DRAW_FIRST_FRAME; state.progress = TEST_BEFORE_DRAW_FIRST_FRAME;
state.ct = clutter_cairo_texture_new (BLOCK_SIZE * 2, BLOCK_SIZE); state.ct = clutter_cairo_texture_new (BLOCK_SIZE * 2, BLOCK_SIZE);
@ -192,5 +192,7 @@ test_clutter_cairo_texture (TestConformSimpleFixture *fixture,
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
clutter_actor_destroy (state.stage);
} }

View File

@ -33,7 +33,7 @@ test_texture_pick_with_alpha (TestConformSimpleFixture *fixture,
gconstpointer data) gconstpointer data)
{ {
ClutterTexture *tex = CLUTTER_TEXTURE (clutter_texture_new ()); ClutterTexture *tex = CLUTTER_TEXTURE (clutter_texture_new ());
ClutterStage *stage = CLUTTER_STAGE (clutter_stage_get_default ()); ClutterStage *stage = CLUTTER_STAGE (clutter_stage_new ());
ClutterActor *actor; ClutterActor *actor;
clutter_texture_set_cogl_texture (tex, make_texture ()); clutter_texture_set_cogl_texture (tex, make_texture ());
@ -81,7 +81,7 @@ test_texture_pick_with_alpha (TestConformSimpleFixture *fixture,
g_print ("actor @ (10, 10) = %p\n", actor); g_print ("actor @ (10, 10) = %p\n", actor);
g_assert (actor == CLUTTER_ACTOR (tex)); g_assert (actor == CLUTTER_ACTOR (tex));
clutter_actor_destroy (CLUTTER_ACTOR (tex)); clutter_actor_destroy (CLUTTER_ACTOR (stage));
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");

View File

@ -298,7 +298,7 @@ test_cogl_backface_culling (TestConformSimpleFixture *fixture,
ClutterActor *group; ClutterActor *group;
guint idle_source; guint idle_source;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_get_size (stage, &stage_width, &stage_height); clutter_actor_get_size (stage, &stage_width, &stage_height);
state.offscreen = COGL_INVALID_HANDLE; state.offscreen = COGL_INVALID_HANDLE;
@ -333,7 +333,8 @@ test_cogl_backface_culling (TestConformSimpleFixture *fixture,
cogl_handle_unref (state.offscreen_tex); cogl_handle_unref (state.offscreen_tex);
cogl_handle_unref (state.texture); cogl_handle_unref (state.texture);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -405,7 +405,7 @@ test_cogl_blend_strings (TestConformSimpleFixture *fixture,
ClutterActor *group; ClutterActor *group;
guint idle_source; guint idle_source;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_actor_get_geometry (stage, &state.stage_geom); clutter_actor_get_geometry (stage, &state.stage_geom);
@ -426,7 +426,8 @@ test_cogl_blend_strings (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -308,7 +308,7 @@ test_cogl_depth_test (TestConformSimpleFixture *fixture,
ClutterActor *group; ClutterActor *group;
guint idle_source; guint idle_source;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_actor_get_geometry (stage, &state.stage_geom); clutter_actor_get_geometry (stage, &state.stage_geom);
@ -329,7 +329,8 @@ test_cogl_depth_test (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -112,11 +112,11 @@ test_cogl_just_vertex_shader (TestConformSimpleFixture *fixture,
ClutterActor *stage; ClutterActor *stage;
guint paint_handler; guint paint_handler;
stage = clutter_stage_get_default ();
/* If shaders aren't supported then we can't run the test */ /* If shaders aren't supported then we can't run the test */
if (cogl_features_available (COGL_FEATURE_SHADERS_GLSL)) if (cogl_features_available (COGL_FEATURE_SHADERS_GLSL))
{ {
stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
paint_handler = g_signal_connect_after (stage, "paint", paint_handler = g_signal_connect_after (stage, "paint",
@ -128,10 +128,11 @@ test_cogl_just_vertex_shader (TestConformSimpleFixture *fixture,
g_signal_handler_disconnect (stage, paint_handler); g_signal_handler_disconnect (stage, paint_handler);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }
else if (g_test_verbose ()) else if (g_test_verbose ())
g_print ("Skipping\n"); g_print ("Skipping\n");
} }

View File

@ -333,7 +333,7 @@ test_cogl_materials (TestConformSimpleFixture *fixture,
test_conform_get_gl_functions (&gl_functions); test_conform_get_gl_functions (&gl_functions);
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_actor_get_geometry (stage, &state.stage_geom); clutter_actor_get_geometry (stage, &state.stage_geom);
@ -354,7 +354,8 @@ test_cogl_materials (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -181,7 +181,7 @@ test_cogl_multitexture (TestConformSimpleFixture *fixture,
ClutterActor *group; ClutterActor *group;
guint idle_source; guint idle_source;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
@ -201,6 +201,8 @@ test_cogl_multitexture (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -32,15 +32,18 @@ static const ClutterColor corner_colors[PARTS * PARTS] =
typedef struct _TestState typedef struct _TestState
{ {
ClutterActor *stage;
guint frame; guint frame;
CoglHandle texture; CoglHandle texture;
} TestState; } TestState;
static gboolean static gboolean
validate_part (int xnum, int ynum, const ClutterColor *color) validate_part (ClutterActor *stage,
int xnum,
int ynum,
const ClutterColor *color)
{ {
guchar *pixels, *p; guchar *pixels, *p;
ClutterActor *stage = clutter_stage_get_default ();
gboolean ret = TRUE; gboolean ret = TRUE;
/* Read the appropriate part but skip out a few pixels around the /* Read the appropriate part but skip out a few pixels around the
@ -75,10 +78,10 @@ validate_result (TestState *state)
{ {
/* Validate that all four corners of the texture are drawn in the /* Validate that all four corners of the texture are drawn in the
right color */ right color */
g_assert (validate_part (0, 0, corner_colors + 0)); g_assert (validate_part (state->stage, 0, 0, corner_colors + 0));
g_assert (validate_part (1, 0, corner_colors + 1)); g_assert (validate_part (state->stage, 1, 0, corner_colors + 1));
g_assert (validate_part (0, 1, corner_colors + 2)); g_assert (validate_part (state->stage, 0, 1, corner_colors + 2));
g_assert (validate_part (1, 1, corner_colors + 3)); g_assert (validate_part (state->stage, 1, 1, corner_colors + 3));
/* Comment this out if you want visual feedback of what this test /* Comment this out if you want visual feedback of what this test
* paints. * paints.
@ -208,7 +211,7 @@ test_cogl_npot_texture (TestConformSimpleFixture *fixture,
state.texture = make_texture (); state.texture = make_texture ();
stage = clutter_stage_get_default (); state.stage = stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
@ -230,7 +233,8 @@ test_cogl_npot_texture (TestConformSimpleFixture *fixture,
cogl_handle_unref (state.texture); cogl_handle_unref (state.texture);
clutter_actor_destroy (state.stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -142,7 +142,7 @@ test_cogl_offscreen (TestConformSimpleFixture *fixture,
guint idle_source; guint idle_source;
ClutterActor *stage; ClutterActor *stage;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
/* We force continuous redrawing of the stage, since we need to skip /* We force continuous redrawing of the stage, since we need to skip
@ -156,12 +156,8 @@ test_cogl_offscreen (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
/* Remove all of the actors from the stage */ clutter_actor_destroy (stage);
clutter_container_foreach (CLUTTER_CONTAINER (stage),
(ClutterCallback) clutter_actor_destroy,
NULL);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -212,7 +212,7 @@ test_cogl_path (TestConformSimpleFixture *fixture,
unsigned int paint_handler; unsigned int paint_handler;
state.frame = 0; state.frame = 0;
state.stage = clutter_stage_get_default (); state.stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (state.stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (state.stage), &stage_color);
/* We force continuous redrawing of the stage, since we need to skip /* We force continuous redrawing of the stage, since we need to skip
@ -228,7 +228,8 @@ test_cogl_path (TestConformSimpleFixture *fixture,
g_signal_handler_disconnect (state.stage, paint_handler); g_signal_handler_disconnect (state.stage, paint_handler);
g_source_remove (idle_source); g_source_remove (idle_source);
clutter_actor_destroy (state.stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -119,7 +119,7 @@ test_cogl_pipeline_user_matrix (TestConformSimpleFixture *fixture,
guint idle_source; guint idle_source;
guint paint_handler; guint paint_handler;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
@ -139,6 +139,8 @@ test_cogl_pipeline_user_matrix (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
g_signal_handler_disconnect (stage, paint_handler); g_signal_handler_disconnect (stage, paint_handler);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -286,7 +286,7 @@ test_cogl_pixel_array (TestConformSimpleFixture *fixture,
state.frame = 0; state.frame = 0;
state.stage = clutter_stage_get_default (); state.stage = clutter_stage_new ();
create_map_tile (&tiles[TILE_MAP]); create_map_tile (&tiles[TILE_MAP]);
#if 0 #if 0
@ -319,12 +319,8 @@ test_cogl_pixel_array (TestConformSimpleFixture *fixture,
cogl_handle_unref (state.tiles[i].texture); cogl_handle_unref (state.tiles[i].texture);
} }
/* Remove all of the actors from the stage */ clutter_actor_destroy (state.stage);
clutter_container_foreach (CLUTTER_CONTAINER (state.stage),
(ClutterCallback) clutter_actor_destroy,
NULL);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -340,7 +340,7 @@ test_cogl_premult (TestConformSimpleFixture *fixture,
cogl_material_set_layer_combine (state.passthrough_material, 0, cogl_material_set_layer_combine (state.passthrough_material, 0,
"RGBA = REPLACE (TEXTURE)", NULL); "RGBA = REPLACE (TEXTURE)", NULL);
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_actor_get_geometry (stage, &state.stage_geom); clutter_actor_get_geometry (stage, &state.stage_geom);
@ -361,7 +361,8 @@ test_cogl_premult (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -211,7 +211,7 @@ test_cogl_primitive (TestConformSimpleFixture *fixture,
ClutterActor *stage; ClutterActor *stage;
guint paint_handler; guint paint_handler;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
@ -224,7 +224,8 @@ test_cogl_primitive (TestConformSimpleFixture *fixture,
g_signal_handler_disconnect (stage, paint_handler); g_signal_handler_disconnect (stage, paint_handler);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -153,7 +153,7 @@ test_cogl_readpixels (TestConformSimpleFixture *fixture,
guint idle_source; guint idle_source;
ClutterActor *stage; ClutterActor *stage;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
/* We force continuous redrawing of the stage, since we need to skip /* We force continuous redrawing of the stage, since we need to skip
@ -167,12 +167,8 @@ test_cogl_readpixels (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
/* Remove all of the actors from the stage */ clutter_actor_destroy (stage);
clutter_container_foreach (CLUTTER_CONTAINER (stage),
(ClutterCallback) clutter_actor_destroy,
NULL);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -339,7 +339,7 @@ test_cogl_sub_texture (TestConformSimpleFixture *fixture,
state.frame = 0; state.frame = 0;
state.stage = clutter_stage_get_default (); state.stage = clutter_stage_new ();
state.tex = create_source (); state.tex = create_source ();
clutter_stage_set_color (CLUTTER_STAGE (state.stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (state.stage), &stage_color);
@ -361,12 +361,8 @@ test_cogl_sub_texture (TestConformSimpleFixture *fixture,
cogl_handle_unref (state.tex); cogl_handle_unref (state.tex);
/* Remove all of the actors from the stage */ clutter_actor_destroy (state.stage);
clutter_container_foreach (CLUTTER_CONTAINER (state.stage),
(ClutterCallback) clutter_actor_destroy,
NULL);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -204,12 +204,11 @@ test_cogl_texture_3d (TestConformSimpleFixture *fixture,
ClutterActor *stage; ClutterActor *stage;
guint paint_handler; guint paint_handler;
stage = clutter_stage_get_default ();
/* Check whether GL supports the rectangle extension. If not we'll /* Check whether GL supports the rectangle extension. If not we'll
just assume the test passes */ just assume the test passes */
if (cogl_features_available (COGL_FEATURE_TEXTURE_3D)) if (cogl_features_available (COGL_FEATURE_TEXTURE_3D))
{ {
stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
paint_handler = g_signal_connect_after (stage, "paint", paint_handler = g_signal_connect_after (stage, "paint",
@ -221,10 +220,11 @@ test_cogl_texture_3d (TestConformSimpleFixture *fixture,
g_signal_handler_disconnect (stage, paint_handler); g_signal_handler_disconnect (stage, paint_handler);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }
else if (g_test_verbose ()) else if (g_test_verbose ())
g_print ("Skipping\n"); g_print ("Skipping\n");
} }

View File

@ -150,7 +150,7 @@ test_cogl_texture_get_set_data (TestConformSimpleFixture *fixture,
/* We create a stage even though we don't usually need it so that if /* We create a stage even though we don't usually need it so that if
the draw-and-read texture fallback is needed then it will have the draw-and-read texture fallback is needed then it will have
something to draw to */ something to draw to */
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
paint_handler = g_signal_connect_after (stage, "paint", paint_handler = g_signal_connect_after (stage, "paint",
G_CALLBACK (paint_cb), NULL); G_CALLBACK (paint_cb), NULL);
@ -161,6 +161,8 @@ test_cogl_texture_get_set_data (TestConformSimpleFixture *fixture,
g_signal_handler_disconnect (stage, paint_handler); g_signal_handler_disconnect (stage, paint_handler);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -111,8 +111,7 @@ test_cogl_texture_mipmaps (TestConformSimpleFixture *fixture,
ClutterActor *group; ClutterActor *group;
guint idle_source; guint idle_source;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
group = clutter_group_new (); group = clutter_group_new ();
@ -131,6 +130,8 @@ test_cogl_texture_mipmaps (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -202,13 +202,14 @@ test_cogl_texture_pixmap_x11 (TestConformSimpleFixture *fixture,
gconstpointer data) gconstpointer data)
{ {
#ifdef CLUTTER_WINDOWING_X11 #ifdef CLUTTER_WINDOWING_X11
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
{
TestState state; TestState state;
guint idle_handler; guint idle_handler;
guint paint_handler; guint paint_handler;
state.frame_count = 0; state.frame_count = 0;
state.stage = clutter_stage_get_default (); state.stage = clutter_stage_new ();
state.display = clutter_x11_get_default_display (); state.display = clutter_x11_get_default_display ();
@ -232,14 +233,13 @@ test_cogl_texture_pixmap_x11 (TestConformSimpleFixture *fixture,
XFreePixmap (state.display, state.pixmap); XFreePixmap (state.display, state.pixmap);
clutter_actor_destroy (state.stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
}
#else /* CLUTTER_WINDOWING_X11 */ else
#endif
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("Skipping\n"); g_print ("Skipping\n");
#endif /* CLUTTER_WINDOWING_X11 */
} }

View File

@ -248,7 +248,7 @@ test_cogl_texture_rectangle (TestConformSimpleFixture *fixture,
guint idle_source; guint idle_source;
guint paint_handler; guint paint_handler;
state.stage = clutter_stage_get_default (); state.stage = clutter_stage_new ();
test_conform_get_gl_functions (&gl_functions); test_conform_get_gl_functions (&gl_functions);
@ -273,6 +273,8 @@ test_cogl_texture_rectangle (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
g_signal_handler_disconnect (state.stage, paint_handler); g_signal_handler_disconnect (state.stage, paint_handler);
clutter_actor_destroy (state.stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -167,7 +167,7 @@ test_cogl_vertex_buffer_contiguous (TestConformSimpleFixture *fixture,
0x00, 0xff, 0x00, 0xff 0x00, 0xff, 0x00, 0xff
}; };
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
clutter_actor_get_geometry (stage, &state.stage_geom); clutter_actor_get_geometry (stage, &state.stage_geom);
@ -251,7 +251,8 @@ test_cogl_vertex_buffer_contiguous (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -92,7 +92,7 @@ test_cogl_vertex_buffer_interleved (TestConformSimpleFixture *fixture,
ClutterActor *group; ClutterActor *group;
guint idle_source; guint idle_source;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
clutter_actor_get_geometry (stage, &state.stage_geom); clutter_actor_get_geometry (stage, &state.stage_geom);
@ -156,7 +156,8 @@ test_cogl_vertex_buffer_interleved (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -135,7 +135,7 @@ test_cogl_vertex_buffer_mutability (TestConformSimpleFixture *fixture,
ClutterActor *group; ClutterActor *group;
guint idle_source; guint idle_source;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
clutter_actor_get_geometry (stage, &state.stage_geom); clutter_actor_get_geometry (stage, &state.stage_geom);
@ -192,7 +192,8 @@ test_cogl_vertex_buffer_mutability (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -391,7 +391,7 @@ test_cogl_viewport (TestConformSimpleFixture *fixture,
guint idle_source; guint idle_source;
ClutterActor *stage; ClutterActor *stage;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
/* We force continuous redrawing of the stage, since we need to skip /* We force continuous redrawing of the stage, since we need to skip
@ -405,12 +405,8 @@ test_cogl_viewport (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
/* Remove all of the actors from the stage */ clutter_actor_destroy (stage);
clutter_container_foreach (CLUTTER_CONTAINER (stage),
(ClutterCallback) clutter_actor_destroy,
NULL);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -293,7 +293,7 @@ test_cogl_wrap_modes (TestConformSimpleFixture *fixture,
guint idle_source; guint idle_source;
guint paint_handler; guint paint_handler;
state.stage = clutter_stage_get_default (); state.stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (state.stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (state.stage), &stage_color);
@ -312,6 +312,8 @@ test_cogl_wrap_modes (TestConformSimpleFixture *fixture,
g_source_remove (idle_source); g_source_remove (idle_source);
g_signal_handler_disconnect (state.stage, paint_handler); g_signal_handler_disconnect (state.stage, paint_handler);
clutter_actor_destroy (state.stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -145,6 +145,7 @@ main (int argc, char **argv)
TEST_CONFORM_SIMPLE ("/invariants", test_show_on_set_parent); TEST_CONFORM_SIMPLE ("/invariants", test_show_on_set_parent);
TEST_CONFORM_SIMPLE ("/invariants", test_clone_no_map); TEST_CONFORM_SIMPLE ("/invariants", test_clone_no_map);
TEST_CONFORM_SIMPLE ("/invariants", test_contains); TEST_CONFORM_SIMPLE ("/invariants", test_contains);
TEST_CONFORM_SIMPLE ("/invariants", default_stage);
TEST_CONFORM_SIMPLE ("/opacity", test_label_opacity); TEST_CONFORM_SIMPLE ("/opacity", test_label_opacity);
TEST_CONFORM_SIMPLE ("/opacity", test_rectangle_opacity); TEST_CONFORM_SIMPLE ("/opacity", test_rectangle_opacity);

View File

@ -301,7 +301,7 @@ test_offscreen_redirect (TestConformSimpleFixture *fixture,
{ {
Data data; Data data;
data.stage = clutter_stage_get_default (); data.stage = clutter_stage_new ();
data.parent_container = clutter_group_new (); data.parent_container = clutter_group_new ();
@ -337,6 +337,8 @@ test_offscreen_redirect (TestConformSimpleFixture *fixture,
clutter_main (); clutter_main ();
clutter_actor_destroy (data.stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -12,7 +12,7 @@ test_label_opacity (TestConformSimpleFixture *fixture,
ClutterColor label_color = { 255, 0, 0, 128 }; ClutterColor label_color = { 255, 0, 0, 128 };
ClutterColor color_check = { 0, }; ClutterColor color_check = { 0, };
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
label = clutter_text_new_with_text ("Sans 18px", "Label, 50% opacity"); label = clutter_text_new_with_text ("Sans 18px", "Label, 50% opacity");
clutter_text_set_color (CLUTTER_TEXT (label), &label_color); clutter_text_set_color (CLUTTER_TEXT (label), &label_color);
@ -39,7 +39,7 @@ test_label_opacity (TestConformSimpleFixture *fixture,
clutter_actor_set_opacity (label, 128); clutter_actor_set_opacity (label, 128);
g_assert (clutter_actor_get_paint_opacity (label) == 128); g_assert (clutter_actor_get_paint_opacity (label) == 128);
clutter_actor_destroy (label); clutter_actor_destroy (stage);
} }
void void
@ -51,7 +51,7 @@ test_rectangle_opacity (TestConformSimpleFixture *fixture,
ClutterColor rect_color = { 0, 0, 255, 255 }; ClutterColor rect_color = { 0, 0, 255, 255 };
ClutterColor color_check = { 0, }; ClutterColor color_check = { 0, };
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
rect = clutter_rectangle_new_with_color (&rect_color); rect = clutter_rectangle_new_with_color (&rect_color);
clutter_actor_set_size (rect, 128, 128); clutter_actor_set_size (rect, 128, 128);
@ -73,7 +73,7 @@ test_rectangle_opacity (TestConformSimpleFixture *fixture,
g_print ("rect 100%%.get_paint_opacity()\n"); g_print ("rect 100%%.get_paint_opacity()\n");
g_assert (clutter_actor_get_paint_opacity (rect) == 255); g_assert (clutter_actor_get_paint_opacity (rect) == 255);
clutter_actor_destroy (rect); clutter_actor_destroy (stage);
} }
void void
@ -86,7 +86,7 @@ test_paint_opacity (TestConformSimpleFixture *fixture,
ClutterColor rect_color = { 0, 0, 255, 255 }; ClutterColor rect_color = { 0, 0, 255, 255 };
ClutterColor color_check = { 0, }; ClutterColor color_check = { 0, };
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
group1 = clutter_group_new (); group1 = clutter_group_new ();
clutter_actor_set_opacity (group1, 128); clutter_actor_set_opacity (group1, 128);
@ -138,7 +138,5 @@ test_paint_opacity (TestConformSimpleFixture *fixture,
g_print ("rect 100%%.get_paint_opacity()\n"); g_print ("rect 100%%.get_paint_opacity()\n");
g_assert (clutter_actor_get_paint_opacity (rect) == 128); g_assert (clutter_actor_get_paint_opacity (rect) == 128);
clutter_actor_destroy (rect); clutter_actor_destroy (stage);
clutter_actor_destroy (group2);
clutter_actor_destroy (group1);
} }

View File

@ -240,7 +240,7 @@ actor_picking (void)
state.pass = TRUE; state.pass = TRUE;
state.stage = clutter_stage_get_default (); state.stage = clutter_stage_new ();
state.actor_width = STAGE_WIDTH / ACTORS_X; state.actor_width = STAGE_WIDTH / ACTORS_X;
state.actor_height = STAGE_HEIGHT / ACTORS_Y; state.actor_height = STAGE_HEIGHT / ACTORS_Y;
@ -271,9 +271,10 @@ actor_picking (void)
clutter_main (); clutter_main ();
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("end result: %s\n", state.pass ? "pass" : "FAIL"); g_print ("end result: %s\n", state.pass ? "pass" : "FAIL");
g_assert (state.pass); g_assert (state.pass);
clutter_actor_destroy (state.stage);
} }

View File

@ -54,8 +54,8 @@ test_score (TestConformSimpleFixture *fixture,
ClutterTimeline *timeline_5; ClutterTimeline *timeline_5;
GSList *timelines; GSList *timelines;
/* this is necessary to make the master clock spin */ /* FIXME - this is necessary to make the master clock spin */
(void) clutter_stage_get_default (); ClutterActor *stage = clutter_stage_new ();
timeline_1 = clutter_timeline_new (100); timeline_1 = clutter_timeline_new (100);
g_object_set_data_full (G_OBJECT (timeline_1), g_object_set_data_full (G_OBJECT (timeline_1),
@ -110,6 +110,8 @@ test_score (TestConformSimpleFixture *fixture,
clutter_score_start (score); clutter_score_start (score);
clutter_actor_destroy (stage);
g_object_unref (timeline_1); g_object_unref (timeline_1);
g_object_unref (timeline_2); g_object_unref (timeline_2);
g_object_unref (timeline_3); g_object_unref (timeline_3);

View File

@ -239,7 +239,7 @@ test_shader_effect (TestConformSimpleFixture *fixture,
ClutterActor *stage; ClutterActor *stage;
ClutterActor *rect; ClutterActor *rect;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
rect = make_actor (foo_old_shader_effect_get_type ()); rect = make_actor (foo_old_shader_effect_get_type ());
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect); clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
@ -262,6 +262,8 @@ test_shader_effect (TestConformSimpleFixture *fixture,
clutter_main (); clutter_main ();
clutter_actor_destroy (stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -263,7 +263,7 @@ text_cache (void)
memset (&data, 0, sizeof (data)); memset (&data, 0, sizeof (data));
data.stage = clutter_stage_get_default (); data.stage = clutter_stage_new ();
data.label = clutter_text_new_with_text (TEST_FONT, ""); data.label = clutter_text_new_with_text (TEST_FONT, "");
@ -279,6 +279,8 @@ text_cache (void)
clutter_main (); clutter_main ();
clutter_actor_destroy (data.stage);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("\nOverall result: "); g_print ("\nOverall result: ");

View File

@ -173,14 +173,12 @@ test_texture_fbo (TestConformSimpleFixture *fixture,
gconstpointer data) gconstpointer data)
{ {
TestState state; TestState state;
guint idle_source;
gulong paint_handler;
ClutterActor *actor; ClutterActor *actor;
int ypos = 0; int ypos = 0;
state.frame = 0; state.frame = 0;
state.stage = clutter_stage_get_default (); state.stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (state.stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (state.stage), &stage_color);
@ -229,25 +227,15 @@ test_texture_fbo (TestConformSimpleFixture *fixture,
/* We force continuous redrawing of the stage, since we need to skip /* We force continuous redrawing of the stage, since we need to skip
* the first few frames, and we wont be doing anything else that * the first few frames, and we wont be doing anything else that
* will trigger redrawing. */ * will trigger redrawing. */
idle_source = g_idle_add (queue_redraw, state.stage); g_idle_add (queue_redraw, state.stage);
g_signal_connect_after (state.stage, "paint", G_CALLBACK (on_paint), &state);
paint_handler = g_signal_connect_after (state.stage, "paint",
G_CALLBACK (on_paint), &state);
clutter_actor_show_all (state.stage); clutter_actor_show_all (state.stage);
clutter_main (); clutter_main ();
g_signal_handler_disconnect (state.stage, paint_handler); clutter_actor_destroy (state.stage);
g_source_remove (idle_source);
/* Remove all of the actors from the stage */
clutter_container_foreach (CLUTTER_CONTAINER (state.stage),
(ClutterCallback) clutter_actor_destroy,
NULL);
if (g_test_verbose ()) if (g_test_verbose ())
g_print ("OK\n"); g_print ("OK\n");
} }

View File

@ -185,7 +185,6 @@ void
test_timeline (TestConformSimpleFixture *fixture, test_timeline (TestConformSimpleFixture *fixture,
gconstpointer data) gconstpointer data)
{ {
ClutterActor *stage G_GNUC_UNUSED;
ClutterTimeline *timeline_1; ClutterTimeline *timeline_1;
TimelineData data_1; TimelineData data_1;
ClutterTimeline *timeline_2; ClutterTimeline *timeline_2;
@ -198,7 +197,7 @@ test_timeline (TestConformSimpleFixture *fixture,
/* NB: We have to ensure a stage is instantiated else the master /* NB: We have to ensure a stage is instantiated else the master
* clock wont run... */ * clock wont run... */
stage = clutter_stage_get_default (); ClutterActor *stage = clutter_stage_new ();
timeline_data_init (&data_1, 1); timeline_data_init (&data_1, 1);
timeline_1 = clutter_timeline_new (FRAME_COUNT * 1000 / FPS); timeline_1 = clutter_timeline_new (FRAME_COUNT * 1000 / FPS);
@ -316,4 +315,6 @@ test_timeline (TestConformSimpleFixture *fixture,
timeline_data_destroy (&data_3); timeline_data_destroy (&data_3);
g_source_remove (delay_tag); g_source_remove (delay_tag);
clutter_actor_destroy (stage);
} }

View File

@ -10,7 +10,8 @@
typedef struct SuperOH typedef struct SuperOH
{ {
ClutterActor **hand, *bgtex; ClutterActor **hand;
ClutterActor *bgtex;
ClutterActor *real_hand; ClutterActor *real_hand;
ClutterActor *group; ClutterActor *group;
ClutterActor *stage; ClutterActor *stage;
@ -22,6 +23,8 @@ typedef struct SuperOH
ClutterBehaviour *scaler_1; ClutterBehaviour *scaler_1;
ClutterBehaviour *scaler_2; ClutterBehaviour *scaler_2;
ClutterTimeline *timeline; ClutterTimeline *timeline;
guint frame_id;
} SuperOH; } SuperOH;
static gint n_hands = NHANDS; static gint n_hands = NHANDS;
@ -36,6 +39,15 @@ static GOptionEntry super_oh_entries[] = {
{ NULL } { NULL }
}; };
static void
clean_and_quit (ClutterActor *actor,
SuperOH *oh)
{
g_signal_handler_disconnect (oh->timeline, oh->frame_id);
clutter_main_quit ();
}
static gboolean static gboolean
on_button_press_event (ClutterActor *actor, on_button_press_event (ClutterActor *actor,
ClutterEvent *event, ClutterEvent *event,
@ -155,19 +167,22 @@ test_actor_clone_main (int argc, char *argv[])
return EXIT_FAILURE; return EXIT_FAILURE;
} }
stage = clutter_stage_get_default (); oh = g_new (SuperOH, 1);
oh->stage = stage = clutter_stage_new ();
clutter_actor_set_size (stage, 800, 600); clutter_actor_set_size (stage, 800, 600);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Clone Test"); clutter_stage_set_title (CLUTTER_STAGE (stage), "Clone Test");
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
oh = g_new (SuperOH, 1); g_signal_connect (stage, "destroy", G_CALLBACK (clean_and_quit), oh);
/* Create a timeline to manage animation */ /* Create a timeline to manage animation */
oh->timeline = clutter_timeline_new (6000); oh->timeline = clutter_timeline_new (6000);
clutter_timeline_set_loop (oh->timeline, TRUE); clutter_timeline_set_loop (oh->timeline, TRUE);
/* fire a callback for frame change */ /* fire a callback for frame change */
oh->frame_id =
g_signal_connect (oh->timeline, "new-frame", G_CALLBACK (frame_cb), oh); g_signal_connect (oh->timeline, "new-frame", G_CALLBACK (frame_cb), oh);
/* Set up some behaviours to handle scaling */ /* Set up some behaviours to handle scaling */
@ -274,11 +289,12 @@ test_actor_clone_main (int argc, char *argv[])
clutter_main (); clutter_main ();
/* clean up */
g_object_unref (oh->scaler_1); g_object_unref (oh->scaler_1);
g_object_unref (oh->scaler_2); g_object_unref (oh->scaler_2);
g_object_unref (oh->timeline); g_object_unref (oh->timeline);
g_free (oh->hand); g_free (oh->hand);
g_free (oh); g_free (oh);
return EXIT_SUCCESS; return EXIT_SUCCESS;

View File

@ -84,15 +84,16 @@ G_MODULE_EXPORT int
test_animation_main (int argc, char *argv[]) test_animation_main (int argc, char *argv[])
{ {
ClutterActor *stage, *rect; ClutterActor *stage, *rect;
ClutterColor stage_color = { 0x66, 0x66, 0xdd, 0xff };
ClutterColor rect_color = { 0x44, 0xdd, 0x44, 0xff }; ClutterColor rect_color = { 0x44, 0xdd, 0x44, 0xff };
ClutterAction *action; ClutterAction *action;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_LightSkyBlue);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Animation");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
rect = clutter_rectangle_new_with_color (&rect_color); rect = clutter_rectangle_new_with_color (&rect_color);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect); clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);

View File

@ -55,7 +55,9 @@ test_animator_main (gint argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); 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++) for (i = 0; i < COUNT; i++)
{ {
@ -66,7 +68,7 @@ test_animator_main (gint argc,
clutter_actor_set_opacity (rects[i], 0x70); clutter_actor_set_opacity (rects[i], 0x70);
} }
g_timeout_add (10000, nuke_one, rects[2]); clutter_threads_add_timeout (10000, nuke_one, rects[2]);
animator = clutter_animator_new (); animator = clutter_animator_new ();
@ -129,6 +131,7 @@ test_animator_main (gint argc,
g_signal_connect (clutter_animator_start (animator), g_signal_connect (clutter_animator_start (animator),
"completed", G_CALLBACK (reverse_timeline), NULL); "completed", G_CALLBACK (reverse_timeline), NULL);
clutter_main (); clutter_main ();
g_object_unref (animator); g_object_unref (animator);
return EXIT_SUCCESS; return EXIT_SUCCESS;

View File

@ -163,10 +163,11 @@ test_bin_layout_main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Box test"); clutter_stage_set_title (CLUTTER_STAGE (stage), "BinLayout");
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_actor_set_size (stage, 640, 480); clutter_actor_set_size (stage, 640, 480);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
CLUTTER_BIN_ALIGNMENT_CENTER); CLUTTER_BIN_ALIGNMENT_CENTER);
@ -269,3 +270,9 @@ test_bin_layout_main (int argc, char *argv[])
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
G_MODULE_EXPORT const char *
test_bin_layout_describe (void)
{
return "BinLayout layout manager example";
}

View File

@ -250,10 +250,11 @@ test_binding_pool_main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
g_signal_connect (stage, g_signal_connect (stage,
"button-press-event", G_CALLBACK (clutter_main_quit), "button-press-event", G_CALLBACK (clutter_main_quit),
NULL); NULL);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
key_group = g_object_new (TYPE_KEY_GROUP, NULL); key_group = g_object_new (TYPE_KEY_GROUP, NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), key_group); clutter_container_add_actor (CLUTTER_CONTAINER (stage), key_group);
@ -308,3 +309,9 @@ test_binding_pool_main (int argc, char *argv[])
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
G_MODULE_EXPORT const char *
test_binding_pool_describe (void)
{
return "Binding pools example";
}

View File

@ -242,10 +242,11 @@ test_box_layout_main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Box Layout"); clutter_stage_set_title (CLUTTER_STAGE (stage), "Box Layout");
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE); clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
clutter_actor_set_size (stage, 640, 480); clutter_actor_set_size (stage, 640, 480);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
layout = clutter_box_layout_new (); layout = clutter_box_layout_new ();
@ -273,3 +274,9 @@ test_box_layout_main (int argc, char *argv[])
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
G_MODULE_EXPORT const char *
test_box_layout_describe (void)
{
return "BoxLayout layout manager example";
}

View File

@ -23,7 +23,9 @@ typedef struct Flower
} }
Flower; Flower;
ClutterActor* static ClutterActor *stage = NULL;
static ClutterActor *
make_flower_actor (void) make_flower_actor (void)
{ {
/* No science here, just a hack from toying */ /* No science here, just a hack from toying */
@ -141,17 +143,14 @@ tick (ClutterTimeline *timeline,
gint msecs, gint msecs,
gpointer data) gpointer data)
{ {
Flower **flowers = (Flower**)data; Flower **flowers = data;
gint i = 0; gint i = 0;
for (i = 0; i < N_FLOWERS; i++) for (i = 0; i < N_FLOWERS; i++)
{ {
ClutterActor *stage;
flowers[i]->y += flowers[i]->v; flowers[i]->y += flowers[i]->v;
flowers[i]->rot += flowers[i]->rv; flowers[i]->rot += flowers[i]->rv;
stage = clutter_stage_get_default ();
if (flowers[i]->y > (gint) clutter_actor_get_height (stage)) if (flowers[i]->y > (gint) clutter_actor_get_height (stage))
flowers[i]->y = -clutter_actor_get_height (flowers[i]->ctex); flowers[i]->y = -clutter_actor_get_height (flowers[i]->ctex);
@ -167,23 +166,35 @@ tick (ClutterTimeline *timeline,
} }
} }
int static void
stop_and_quit (ClutterActor *actor,
ClutterTimeline *timeline)
{
clutter_timeline_stop (timeline);
clutter_main_quit ();
}
G_MODULE_EXPORT int
test_cairo_flowers_main (int argc, char **argv) test_cairo_flowers_main (int argc, char **argv)
{ {
int i;
ClutterActor *stage;
ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
ClutterTimeline *timeline;
Flower *flowers[N_FLOWERS]; Flower *flowers[N_FLOWERS];
ClutterTimeline *timeline;
int i;
srand (time (NULL)); srand (time (NULL));
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); /* Create a timeline to manage animation */
timeline = clutter_timeline_new (6000);
clutter_timeline_set_loop (timeline, TRUE);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cairo Flowers");
g_signal_connect (stage, "destroy", G_CALLBACK (stop_and_quit), timeline);
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
for (i=0; i< N_FLOWERS; i++) for (i=0; i< N_FLOWERS; i++)
{ {
@ -201,10 +212,6 @@ test_cairo_flowers_main (int argc, char **argv)
flowers[i]->x, flowers[i]->y); flowers[i]->x, flowers[i]->y);
} }
/* Create a timeline to manage animation */
timeline = clutter_timeline_new (6000);
clutter_timeline_set_loop (timeline, TRUE);
/* fire a callback for frame change */ /* fire a callback for frame change */
g_signal_connect (timeline, "new-frame", G_CALLBACK (tick), flowers); g_signal_connect (timeline, "new-frame", G_CALLBACK (tick), flowers);
@ -218,6 +225,13 @@ test_cairo_flowers_main (int argc, char **argv)
clutter_main(); clutter_main();
g_object_unref (timeline);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
G_MODULE_EXPORT const char *
test_cairo_flowers_describe (void)
{
return "Drawing pretty flowers with Cairo";
}

View File

@ -325,7 +325,9 @@ test_clip_main (int argc, char **argv)
data.current_clip.type = CLIP_NONE; data.current_clip.type = CLIP_NONE;
data.clips = NULL; data.clips = NULL;
data.stage = clutter_stage_get_default (); data.stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (data.stage), "Clipping");
g_signal_connect (data.stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
stub_actor = clutter_rectangle_new (); stub_actor = clutter_rectangle_new ();
clutter_container_add (CLUTTER_CONTAINER (data.stage), stub_actor, NULL); clutter_container_add (CLUTTER_CONTAINER (data.stage), stub_actor, NULL);
@ -366,3 +368,9 @@ test_clip_main (int argc, char **argv)
return 0; return 0;
} }
G_MODULE_EXPORT const char *
test_clip_describe (void)
{
return "Actor clipping with various techniques";
}

View File

@ -102,7 +102,7 @@ test_cogl_multitexture_main (int argc, char *argv[])
ClutterActor *stage; ClutterActor *stage;
ClutterColor stage_color = { 0x61, 0x56, 0x56, 0xff }; ClutterColor stage_color = { 0x61, 0x56, 0x56, 0xff };
TestMultiLayerMaterialState *state = g_new0 (TestMultiLayerMaterialState, 1); TestMultiLayerMaterialState *state = g_new0 (TestMultiLayerMaterialState, 1);
ClutterGeometry geom; gfloat stage_w, stage_h;
gchar **files; gchar **files;
gfloat tex_coords[] = gfloat tex_coords[] =
{ {
@ -115,17 +115,20 @@ test_cogl_multitexture_main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_get_geometry (stage, &geom); clutter_actor_get_size (stage, &stage_w, &stage_h);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl: Multi-texturing");
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* We create a non-descript actor that we know doesn't have a /* We create a non-descript actor that we know doesn't have a
* default paint handler, so that we can easily control * default paint handler, so that we can easily control
* painting in a paint signal handler, without having to * painting in a paint signal handler, without having to
* sub-class anything etc. */ * sub-class anything etc. */
state->group = clutter_group_new (); state->group = clutter_group_new ();
clutter_actor_set_position (state->group, geom.width/2, geom.height/2); clutter_actor_set_position (state->group, stage_w / 2, stage_h / 2);
g_signal_connect (state->group, "paint", g_signal_connect (state->group, "paint",
G_CALLBACK(material_rectangle_paint), state); G_CALLBACK(material_rectangle_paint), state);
@ -227,3 +230,9 @@ test_cogl_multitexture_main (int argc, char *argv[])
return 0; return 0;
} }
G_MODULE_EXPORT const char *
test_cogl_multitexture_describe (void)
{
return "Multi-texturing support in Cogl.";
}

View File

@ -225,37 +225,20 @@ setup_viewport (unsigned int width,
} }
static void static void
test_coglbox_init (TestCoglbox *self) test_coglbox_map (ClutterActor *actor)
{ {
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (actor);
ClutterActor *stage; ClutterActor *stage;
TestCoglboxPrivate *priv;
gchar *file;
ClutterPerspective perspective; ClutterPerspective perspective;
float stage_width; float stage_width;
float stage_height; float stage_height;
self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self); CLUTTER_ACTOR_CLASS (test_coglbox_parent_class)->map (actor);
printf ("Loading redhand.png\n");
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
priv->texhand_id = cogl_texture_new_from_file (file,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_ANY,
NULL);
g_free (file);
printf ("Creating texture with size\n");
priv->texture_id = cogl_texture_new_with_size (200, 200,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_RGB_888);
if (priv->texture_id == COGL_INVALID_HANDLE)
printf ("Failed creating texture with size!\n");
printf ("Creating offscreen\n"); printf ("Creating offscreen\n");
priv->offscreen_id = cogl_offscreen_new_to_texture (priv->texture_id); priv->offscreen_id = cogl_offscreen_new_to_texture (priv->texture_id);
stage = clutter_stage_get_default (); stage = clutter_actor_get_stage (actor);
clutter_stage_get_perspective (CLUTTER_STAGE (stage), &perspective); clutter_stage_get_perspective (CLUTTER_STAGE (stage), &perspective);
clutter_actor_get_size (stage, &stage_width, &stage_height); clutter_actor_get_size (stage, &stage_width, &stage_height);
@ -273,6 +256,31 @@ test_coglbox_init (TestCoglbox *self)
printf ("Failed creating offscreen to texture!\n"); printf ("Failed creating offscreen to texture!\n");
} }
static void
test_coglbox_init (TestCoglbox *self)
{
TestCoglboxPrivate *priv;
gchar *file;
self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self);
printf ("Loading redhand.png\n");
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
priv->texhand_id = cogl_texture_new_from_file (file,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_ANY,
NULL);
g_free (file);
printf ("Creating texture with size\n");
priv->texture_id = cogl_texture_new_with_size (200, 200,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_RGB_888);
if (priv->texture_id == COGL_INVALID_HANDLE)
printf ("Failed creating texture with size!\n");
}
static void static void
test_coglbox_class_init (TestCoglboxClass *klass) test_coglbox_class_init (TestCoglboxClass *klass)
{ {
@ -281,6 +289,8 @@ test_coglbox_class_init (TestCoglboxClass *klass)
gobject_class->finalize = test_coglbox_finalize; gobject_class->finalize = test_coglbox_finalize;
gobject_class->dispose = test_coglbox_dispose; gobject_class->dispose = test_coglbox_dispose;
actor_class->map = test_coglbox_map;
actor_class->paint = test_coglbox_paint; actor_class->paint = test_coglbox_paint;
g_type_class_add_private (gobject_class, sizeof (TestCoglboxPrivate)); g_type_class_add_private (gobject_class, sizeof (TestCoglboxPrivate));
@ -302,9 +312,10 @@ test_cogl_offscreen_main (int argc, char *argv[])
return 1; return 1;
/* Stage */ /* Stage */
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400); clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Offscreen Buffers");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Cogl Box */ /* Cogl Box */
coglbox = test_coglbox_new (); coglbox = test_coglbox_new ();
@ -316,3 +327,9 @@ test_cogl_offscreen_main (int argc, char *argv[])
return 0; return 0;
} }
G_MODULE_EXPORT const char *
test_cogl_offscreen_describe (void)
{
return "Offscreen buffer support in Cogl.";
}

View File

@ -219,7 +219,6 @@ idle_cb (gpointer data)
G_MODULE_EXPORT int G_MODULE_EXPORT int
test_cogl_point_sprites_main (int argc, char *argv[]) test_cogl_point_sprites_main (int argc, char *argv[])
{ {
static const ClutterColor black = { 0, 0, 0, 255 };
ClutterActor *stage; ClutterActor *stage;
CoglHandle tex; CoglHandle tex;
Data data; Data data;
@ -260,9 +259,10 @@ test_cogl_point_sprites_main (int argc, char *argv[])
data.sparks[i].y = 2.0f; data.sparks[i].y = 2.0f;
} }
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &black); clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Point Sprites");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
g_signal_connect_after (stage, "paint", G_CALLBACK (paint_cb), &data); g_signal_connect_after (stage, "paint", G_CALLBACK (paint_cb), &data);
clutter_actor_show (stage); clutter_actor_show (stage);
@ -279,3 +279,9 @@ test_cogl_point_sprites_main (int argc, char *argv[])
return 0; return 0;
} }
G_MODULE_EXPORT const char *
test_cogl_point_sprites_describe (void)
{
return "Point sprites support in Cogl.";
}

View File

@ -114,9 +114,10 @@ test_cogl_primitives_main (int argc, char *argv[])
clutter_timeline_set_loop (tl, TRUE); clutter_timeline_set_loop (tl, TRUE);
clutter_timeline_start (tl); clutter_timeline_start (tl);
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400); clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Path Primitives");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
coglbox = clutter_group_new (); coglbox = clutter_group_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox); clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
@ -136,3 +137,9 @@ test_cogl_primitives_main (int argc, char *argv[])
return 0; return 0;
} }
G_MODULE_EXPORT const char *
test_cogl_primitives (void)
{
return "2D Path primitives support in Cogl.";
}

View File

@ -202,9 +202,10 @@ test_cogl_tex_convert_main (int argc, char *argv[])
return 1; return 1;
/* Stage */ /* Stage */
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400); clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Texture Conversion");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Cogl Box */ /* Cogl Box */
coglbox = test_coglbox_new (); coglbox = test_coglbox_new ();
@ -216,3 +217,9 @@ test_cogl_tex_convert_main (int argc, char *argv[])
return 0; return 0;
} }
G_MODULE_EXPORT const char *
test_cogl_tex_convert_describe (void)
{
return "Pixel format conversion of Cogl textures.";
}

View File

@ -226,9 +226,10 @@ test_cogl_tex_foreign_main (int argc, char *argv[])
return 1; return 1;
/* Stage */ /* Stage */
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400); clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Foreign Textures");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Cogl Box */ /* Cogl Box */
coglbox = test_coglbox_new (); coglbox = test_coglbox_new ();
@ -240,3 +241,9 @@ test_cogl_tex_foreign_main (int argc, char *argv[])
return 0; return 0;
} }
G_MODULE_EXPORT const char *
test_cogl_tex_foreign_describe (void)
{
return "Foreign textures support in Cogl.";
}

View File

@ -249,9 +249,10 @@ test_cogl_tex_getset_main (int argc, char *argv[])
return 1; return 1;
/* Stage */ /* Stage */
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400); clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Texture Readback");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Cogl Box */ /* Cogl Box */
coglbox = test_coglbox_new (); coglbox = test_coglbox_new ();
@ -263,3 +264,9 @@ test_cogl_tex_getset_main (int argc, char *argv[])
return 0; return 0;
} }
G_MODULE_EXPORT const char *
test_cogl_tex_getset_describe (void)
{
return "Texture region readback and update in Cogl.";
}

View File

@ -365,10 +365,11 @@ test_cogl_tex_polygon_main (int argc, char *argv[])
return 1; return 1;
/* Stage */ /* Stage */
stage = clutter_stage_get_default (); stage = clutter_stage_new ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &blue); clutter_stage_set_color (CLUTTER_STAGE (stage), &blue);
clutter_actor_set_size (stage, 640, 480); clutter_actor_set_size (stage, 640, 480);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Texture Polygon");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Cogl Box */ /* Cogl Box */
coglbox = test_coglbox_new (); coglbox = test_coglbox_new ();
@ -412,3 +413,9 @@ test_cogl_tex_polygon_main (int argc, char *argv[])
return 0; return 0;
} }
G_MODULE_EXPORT const char *
test_cogl_tex_polygon_describe (void)
{
return "Texture polygon primitive.";
}

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