mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
interactive/*: Do not use clutter_stage_get_default()
This commit is contained in:
parent
6ed879b84c
commit
7c180a0742
@ -55,7 +55,7 @@ test_score (TestConformSimpleFixture *fixture,
|
||||
GSList *timelines;
|
||||
|
||||
/* 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);
|
||||
g_object_set_data_full (G_OBJECT (timeline_1),
|
||||
@ -110,6 +110,8 @@ test_score (TestConformSimpleFixture *fixture,
|
||||
|
||||
clutter_score_start (score);
|
||||
|
||||
clutter_actor_destroy (stage);
|
||||
|
||||
g_object_unref (timeline_1);
|
||||
g_object_unref (timeline_2);
|
||||
g_object_unref (timeline_3);
|
||||
|
@ -185,7 +185,6 @@ void
|
||||
test_timeline (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
{
|
||||
ClutterActor *stage G_GNUC_UNUSED;
|
||||
ClutterTimeline *timeline_1;
|
||||
TimelineData data_1;
|
||||
ClutterTimeline *timeline_2;
|
||||
@ -198,7 +197,7 @@ test_timeline (TestConformSimpleFixture *fixture,
|
||||
|
||||
/* NB: We have to ensure a stage is instantiated else the master
|
||||
* clock wont run... */
|
||||
stage = clutter_stage_get_default ();
|
||||
ClutterActor *stage = clutter_stage_new ();
|
||||
|
||||
timeline_data_init (&data_1, 1);
|
||||
timeline_1 = clutter_timeline_new (FRAME_COUNT * 1000 / FPS);
|
||||
@ -316,4 +315,6 @@ test_timeline (TestConformSimpleFixture *fixture,
|
||||
timeline_data_destroy (&data_3);
|
||||
|
||||
g_source_remove (delay_tag);
|
||||
|
||||
clutter_actor_destroy (stage);
|
||||
}
|
||||
|
@ -10,10 +10,11 @@
|
||||
|
||||
typedef struct SuperOH
|
||||
{
|
||||
ClutterActor **hand, *bgtex;
|
||||
ClutterActor *real_hand;
|
||||
ClutterActor *group;
|
||||
ClutterActor *stage;
|
||||
ClutterActor **hand;
|
||||
ClutterActor *bgtex;
|
||||
ClutterActor *real_hand;
|
||||
ClutterActor *group;
|
||||
ClutterActor *stage;
|
||||
|
||||
gint stage_width;
|
||||
gint stage_height;
|
||||
@ -22,6 +23,8 @@ typedef struct SuperOH
|
||||
ClutterBehaviour *scaler_1;
|
||||
ClutterBehaviour *scaler_2;
|
||||
ClutterTimeline *timeline;
|
||||
|
||||
guint frame_id;
|
||||
} SuperOH;
|
||||
|
||||
static gint n_hands = NHANDS;
|
||||
@ -36,6 +39,15 @@ static GOptionEntry super_oh_entries[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
clean_and_quit (ClutterActor *actor,
|
||||
SuperOH *oh)
|
||||
{
|
||||
g_signal_handler_disconnect (oh->timeline, oh->frame_id);
|
||||
|
||||
clutter_main_quit ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_button_press_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
@ -155,20 +167,23 @@ test_actor_clone_main (int argc, char *argv[])
|
||||
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_stage_set_title (CLUTTER_STAGE (stage), "Clone Test");
|
||||
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 */
|
||||
oh->timeline = clutter_timeline_new (6000);
|
||||
clutter_timeline_set_loop (oh->timeline, TRUE);
|
||||
|
||||
/* fire a callback for frame change */
|
||||
g_signal_connect (oh->timeline, "new-frame", G_CALLBACK (frame_cb), oh);
|
||||
oh->frame_id =
|
||||
g_signal_connect (oh->timeline, "new-frame", G_CALLBACK (frame_cb), oh);
|
||||
|
||||
/* Set up some behaviours to handle scaling */
|
||||
alpha = clutter_alpha_new_with_func (oh->timeline, my_sine_wave, NULL, NULL);
|
||||
@ -207,7 +222,7 @@ test_actor_clone_main (int argc, char *argv[])
|
||||
clutter_actor_hide (real_hand);
|
||||
|
||||
/* create a new group to hold multiple actors in a group */
|
||||
oh->group = clutter_group_new();
|
||||
oh->group = clutter_group_new ();
|
||||
|
||||
oh->hand = g_new (ClutterActor*, n_hands);
|
||||
|
||||
@ -274,11 +289,12 @@ test_actor_clone_main (int argc, char *argv[])
|
||||
|
||||
clutter_main ();
|
||||
|
||||
/* clean up */
|
||||
g_object_unref (oh->scaler_1);
|
||||
g_object_unref (oh->scaler_2);
|
||||
g_object_unref (oh->timeline);
|
||||
|
||||
g_free (oh->hand);
|
||||
|
||||
g_free (oh);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
@ -84,15 +84,16 @@ G_MODULE_EXPORT int
|
||||
test_animation_main (int argc, char *argv[])
|
||||
{
|
||||
ClutterActor *stage, *rect;
|
||||
ClutterColor stage_color = { 0x66, 0x66, 0xdd, 0xff };
|
||||
ClutterColor rect_color = { 0x44, 0xdd, 0x44, 0xff };
|
||||
ClutterAction *action;
|
||||
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
stage = clutter_stage_new ();
|
||||
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);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
|
||||
|
@ -55,18 +55,20 @@ test_animator_main (gint argc,
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
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++)
|
||||
{
|
||||
rects[i]=new_rect (255 *(i * 1.0/COUNT), 50, 160, 255);
|
||||
rects[i] = new_rect (255 * (i * 1.0 / COUNT), 50, 160, 255);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rects[i]);
|
||||
clutter_actor_set_anchor_point (rects[i], 64, 64);
|
||||
clutter_actor_set_position (rects[i], 320.0, 240.0);
|
||||
clutter_actor_set_opacity (rects[i], 0x70);
|
||||
}
|
||||
|
||||
g_timeout_add (10000, nuke_one, rects[2]);
|
||||
clutter_threads_add_timeout (10000, nuke_one, rects[2]);
|
||||
|
||||
animator = clutter_animator_new ();
|
||||
|
||||
@ -129,6 +131,7 @@ test_animator_main (gint argc,
|
||||
g_signal_connect (clutter_animator_start (animator),
|
||||
"completed", G_CALLBACK (reverse_timeline), NULL);
|
||||
clutter_main ();
|
||||
|
||||
g_object_unref (animator);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
@ -163,10 +163,11 @@ test_bin_layout_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Box test");
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "BinLayout");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
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,
|
||||
CLUTTER_BIN_ALIGNMENT_CENTER);
|
||||
@ -269,3 +270,9 @@ test_bin_layout_main (int argc, char *argv[])
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_bin_layout_describe (void)
|
||||
{
|
||||
return "BinLayout layout manager example";
|
||||
}
|
||||
|
@ -250,10 +250,11 @@ test_binding_pool_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
g_signal_connect (stage,
|
||||
"button-press-event", G_CALLBACK (clutter_main_quit),
|
||||
NULL);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
key_group = g_object_new (TYPE_KEY_GROUP, NULL);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), key_group);
|
||||
@ -308,3 +309,9 @@ test_binding_pool_main (int argc, char *argv[])
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_binding_pool_describe (void)
|
||||
{
|
||||
return "Binding pools example";
|
||||
}
|
||||
|
@ -242,10 +242,11 @@ test_box_layout_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Box Layout");
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
clutter_actor_set_size (stage, 640, 480);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
layout = clutter_box_layout_new ();
|
||||
|
||||
@ -273,3 +274,9 @@ test_box_layout_main (int argc, char *argv[])
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_box_layout_describe (void)
|
||||
{
|
||||
return "BoxLayout layout manager example";
|
||||
}
|
||||
|
@ -23,7 +23,9 @@ typedef struct Flower
|
||||
}
|
||||
Flower;
|
||||
|
||||
ClutterActor*
|
||||
static ClutterActor *stage = NULL;
|
||||
|
||||
static ClutterActor *
|
||||
make_flower_actor (void)
|
||||
{
|
||||
/* No science here, just a hack from toying */
|
||||
@ -141,17 +143,14 @@ tick (ClutterTimeline *timeline,
|
||||
gint msecs,
|
||||
gpointer data)
|
||||
{
|
||||
Flower **flowers = (Flower**)data;
|
||||
Flower **flowers = data;
|
||||
gint i = 0;
|
||||
|
||||
for (i = 0; i < N_FLOWERS; i++)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
|
||||
flowers[i]->y += flowers[i]->v;
|
||||
flowers[i]->rot += flowers[i]->rv;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
if (flowers[i]->y > (gint) clutter_actor_get_height (stage))
|
||||
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)
|
||||
{
|
||||
int i;
|
||||
ClutterActor *stage;
|
||||
ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
|
||||
Flower *flowers[N_FLOWERS];
|
||||
ClutterTimeline *timeline;
|
||||
Flower *flowers[N_FLOWERS];
|
||||
int i;
|
||||
|
||||
srand (time (NULL));
|
||||
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
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++)
|
||||
{
|
||||
@ -201,10 +212,6 @@ test_cairo_flowers_main (int argc, char **argv)
|
||||
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 */
|
||||
g_signal_connect (timeline, "new-frame", G_CALLBACK (tick), flowers);
|
||||
|
||||
@ -218,6 +225,13 @@ test_cairo_flowers_main (int argc, char **argv)
|
||||
|
||||
clutter_main();
|
||||
|
||||
g_object_unref (timeline);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_cairo_flowers_describe (void)
|
||||
{
|
||||
return "Drawing pretty flowers with Cairo";
|
||||
}
|
||||
|
@ -325,7 +325,9 @@ test_clip_main (int argc, char **argv)
|
||||
data.current_clip.type = CLIP_NONE;
|
||||
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 ();
|
||||
clutter_container_add (CLUTTER_CONTAINER (data.stage), stub_actor, NULL);
|
||||
@ -366,3 +368,9 @@ test_clip_main (int argc, char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_clip_describe (void)
|
||||
{
|
||||
return "Actor clipping with various techniques";
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ test_cogl_multitexture_main (int argc, char *argv[])
|
||||
ClutterActor *stage;
|
||||
ClutterColor stage_color = { 0x61, 0x56, 0x56, 0xff };
|
||||
TestMultiLayerMaterialState *state = g_new0 (TestMultiLayerMaterialState, 1);
|
||||
ClutterGeometry geom;
|
||||
gfloat stage_w, stage_h;
|
||||
gchar **files;
|
||||
gfloat tex_coords[] =
|
||||
{
|
||||
@ -115,17 +115,20 @@ test_cogl_multitexture_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
clutter_actor_get_geometry (stage, &geom);
|
||||
stage = clutter_stage_new ();
|
||||
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);
|
||||
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
/* We create a non-descript actor that we know doesn't have a
|
||||
* default paint handler, so that we can easily control
|
||||
* painting in a paint signal handler, without having to
|
||||
* sub-class anything etc. */
|
||||
state->group = clutter_group_new ();
|
||||
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_CALLBACK(material_rectangle_paint), state);
|
||||
|
||||
@ -227,3 +230,9 @@ test_cogl_multitexture_main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_cogl_multitexture_describe (void)
|
||||
{
|
||||
return "Multi-texturing support in Cogl.";
|
||||
}
|
||||
|
@ -225,37 +225,20 @@ setup_viewport (unsigned int width,
|
||||
}
|
||||
|
||||
static void
|
||||
test_coglbox_init (TestCoglbox *self)
|
||||
test_coglbox_map (ClutterActor *actor)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (actor);
|
||||
ClutterActor *stage;
|
||||
TestCoglboxPrivate *priv;
|
||||
gchar *file;
|
||||
ClutterPerspective perspective;
|
||||
float stage_width;
|
||||
float stage_height;
|
||||
|
||||
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");
|
||||
CLUTTER_ACTOR_CLASS (test_coglbox_parent_class)->map (actor);
|
||||
|
||||
printf ("Creating offscreen\n");
|
||||
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_actor_get_size (stage, &stage_width, &stage_height);
|
||||
|
||||
@ -273,6 +256,31 @@ test_coglbox_init (TestCoglbox *self)
|
||||
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
|
||||
test_coglbox_class_init (TestCoglboxClass *klass)
|
||||
{
|
||||
@ -281,6 +289,8 @@ test_coglbox_class_init (TestCoglboxClass *klass)
|
||||
|
||||
gobject_class->finalize = test_coglbox_finalize;
|
||||
gobject_class->dispose = test_coglbox_dispose;
|
||||
|
||||
actor_class->map = test_coglbox_map;
|
||||
actor_class->paint = test_coglbox_paint;
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (TestCoglboxPrivate));
|
||||
@ -295,16 +305,17 @@ test_coglbox_new (void)
|
||||
G_MODULE_EXPORT int
|
||||
test_cogl_offscreen_main (int argc, char *argv[])
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterActor *coglbox;
|
||||
ClutterActor *stage;
|
||||
ClutterActor *coglbox;
|
||||
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
/* Stage */
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
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 */
|
||||
coglbox = test_coglbox_new ();
|
||||
@ -316,3 +327,9 @@ test_cogl_offscreen_main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_cogl_offscreen_describe (void)
|
||||
{
|
||||
return "Offscreen buffer support in Cogl.";
|
||||
}
|
||||
|
@ -219,7 +219,6 @@ idle_cb (gpointer data)
|
||||
G_MODULE_EXPORT int
|
||||
test_cogl_point_sprites_main (int argc, char *argv[])
|
||||
{
|
||||
static const ClutterColor black = { 0, 0, 0, 255 };
|
||||
ClutterActor *stage;
|
||||
CoglHandle tex;
|
||||
Data data;
|
||||
@ -260,9 +259,10 @@ test_cogl_point_sprites_main (int argc, char *argv[])
|
||||
data.sparks[i].y = 2.0f;
|
||||
}
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &black);
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
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);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
@ -279,3 +279,9 @@ test_cogl_point_sprites_main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_cogl_point_sprites_describe (void)
|
||||
{
|
||||
return "Point sprites support in Cogl.";
|
||||
}
|
||||
|
@ -114,9 +114,10 @@ test_cogl_primitives_main (int argc, char *argv[])
|
||||
clutter_timeline_set_loop (tl, TRUE);
|
||||
clutter_timeline_start (tl);
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
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 ();
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
|
||||
@ -136,3 +137,9 @@ test_cogl_primitives_main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_cogl_primitives (void)
|
||||
{
|
||||
return "2D Path primitives support in Cogl.";
|
||||
}
|
||||
|
@ -202,10 +202,11 @@ test_cogl_tex_convert_main (int argc, char *argv[])
|
||||
return 1;
|
||||
|
||||
/* Stage */
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
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 */
|
||||
coglbox = test_coglbox_new ();
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
|
||||
@ -216,3 +217,9 @@ test_cogl_tex_convert_main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_cogl_tex_convert_describe (void)
|
||||
{
|
||||
return "Pixel format conversion of Cogl textures.";
|
||||
}
|
||||
|
@ -226,10 +226,11 @@ test_cogl_tex_foreign_main (int argc, char *argv[])
|
||||
return 1;
|
||||
|
||||
/* Stage */
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
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 */
|
||||
coglbox = test_coglbox_new ();
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
|
||||
@ -240,3 +241,9 @@ test_cogl_tex_foreign_main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_cogl_tex_foreign_describe (void)
|
||||
{
|
||||
return "Foreign textures support in Cogl.";
|
||||
}
|
||||
|
@ -249,10 +249,11 @@ test_cogl_tex_getset_main (int argc, char *argv[])
|
||||
return 1;
|
||||
|
||||
/* Stage */
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
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 */
|
||||
coglbox = test_coglbox_new ();
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
|
||||
@ -263,3 +264,9 @@ test_cogl_tex_getset_main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_cogl_tex_getset_describe (void)
|
||||
{
|
||||
return "Texture region readback and update in Cogl.";
|
||||
}
|
||||
|
@ -365,10 +365,11 @@ test_cogl_tex_polygon_main (int argc, char *argv[])
|
||||
return 1;
|
||||
|
||||
/* Stage */
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &blue);
|
||||
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 */
|
||||
coglbox = test_coglbox_new ();
|
||||
@ -412,3 +413,9 @@ test_cogl_tex_polygon_main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_cogl_tex_polygon_describe (void)
|
||||
{
|
||||
return "Texture polygon primitive.";
|
||||
}
|
||||
|
@ -190,9 +190,10 @@ test_cogl_tex_tile_main (int argc, char *argv[])
|
||||
return 1;
|
||||
|
||||
/* Stage */
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
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 Tiling");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
/* Cogl Box */
|
||||
coglbox = test_coglbox_new ();
|
||||
@ -210,3 +211,9 @@ test_cogl_tex_tile_main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_cogl_tex_tile_describe (void)
|
||||
{
|
||||
return "Texture tiling.";
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ typedef struct _TestState
|
||||
guint n_static_indices;
|
||||
CoglHandle indices;
|
||||
ClutterTimeline *timeline;
|
||||
guint frame_id;
|
||||
} TestState;
|
||||
|
||||
static void
|
||||
@ -324,37 +325,47 @@ create_dummy_actor (guint width, guint height)
|
||||
return group;
|
||||
}
|
||||
|
||||
static void
|
||||
stop_and_quit (ClutterActor *actor,
|
||||
TestState *state)
|
||||
{
|
||||
clutter_timeline_stop (state->timeline);
|
||||
clutter_main_quit ();
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT int
|
||||
test_cogl_vertex_buffer_main (int argc, char *argv[])
|
||||
{
|
||||
TestState state;
|
||||
ClutterActor *stage;
|
||||
ClutterColor stage_clr = {0x0, 0x0, 0x0, 0xff};
|
||||
ClutterGeometry stage_geom;
|
||||
gfloat stage_w, stage_h;
|
||||
gint dummy_width, dummy_height;
|
||||
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
|
||||
clutter_actor_get_geometry (stage, &stage_geom);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Vertex Buffers");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (stop_and_quit), &state);
|
||||
clutter_actor_get_size (stage, &stage_w, &stage_h);
|
||||
|
||||
dummy_width = MESH_WIDTH * QUAD_WIDTH;
|
||||
dummy_height = MESH_HEIGHT * QUAD_HEIGHT;
|
||||
state.dummy = create_dummy_actor (dummy_width, dummy_height);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), state.dummy);
|
||||
clutter_actor_set_position (state.dummy,
|
||||
(stage_geom.width / 2.0) - (dummy_width / 2.0),
|
||||
(stage_geom.height / 2.0) - (dummy_height / 2.0));
|
||||
(stage_w / 2.0) - (dummy_width / 2.0),
|
||||
(stage_h / 2.0) - (dummy_height / 2.0));
|
||||
|
||||
state.timeline = clutter_timeline_new (1000);
|
||||
clutter_timeline_set_loop (state.timeline, TRUE);
|
||||
g_signal_connect (state.timeline,
|
||||
"new-frame",
|
||||
G_CALLBACK (frame_cb),
|
||||
&state);
|
||||
|
||||
state.frame_id = g_signal_connect (state.timeline,
|
||||
"new-frame",
|
||||
G_CALLBACK (frame_cb),
|
||||
&state);
|
||||
|
||||
g_signal_connect (state.dummy, "paint", G_CALLBACK (on_paint), &state);
|
||||
|
||||
@ -372,3 +383,8 @@ test_cogl_vertex_buffer_main (int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_cogl_vertex_buffer_describe (void)
|
||||
{
|
||||
return "Vertex buffers support in Cogl.";
|
||||
}
|
||||
|
@ -48,13 +48,13 @@ stage_state_cb (ClutterStage *stage,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
blue_button_cb (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer data)
|
||||
blue_button_cb (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_actor_get_stage (actor);
|
||||
|
||||
if (IsFullScreen)
|
||||
IsFullScreen = FALSE;
|
||||
@ -104,12 +104,12 @@ capture_cb (ClutterActor *actor,
|
||||
}
|
||||
|
||||
static void
|
||||
key_focus_in_cb (ClutterActor *actor,
|
||||
gpointer data)
|
||||
key_focus_in_cb (ClutterActor *actor,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterActor *focus_box = CLUTTER_ACTOR(data);
|
||||
ClutterActor *focus_box = CLUTTER_ACTOR (data);
|
||||
|
||||
if (actor == clutter_stage_get_default ())
|
||||
if (CLUTTER_IS_STAGE (actor))
|
||||
clutter_actor_hide (focus_box);
|
||||
else
|
||||
{
|
||||
@ -171,7 +171,7 @@ input_cb (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterStage *stage = CLUTTER_STAGE (clutter_stage_get_default ());
|
||||
ClutterActor *stage = clutter_actor_get_stage (actor);
|
||||
ClutterActor *source_actor = clutter_event_get_source (event);
|
||||
gchar keybuf[128];
|
||||
|
||||
@ -223,11 +223,11 @@ input_cb (ClutterActor *actor,
|
||||
clutter_event_get_button (event),
|
||||
clutter_event_get_click_count (event));
|
||||
|
||||
if (source_actor == CLUTTER_ACTOR (stage))
|
||||
clutter_stage_set_key_focus (stage, NULL);
|
||||
if (source_actor == stage)
|
||||
clutter_stage_set_key_focus (CLUTTER_STAGE (stage), NULL);
|
||||
else if (source_actor == actor &&
|
||||
clutter_actor_get_parent (actor) == CLUTTER_ACTOR (stage))
|
||||
clutter_stage_set_key_focus (stage, actor);
|
||||
clutter_actor_get_parent (actor) == stage)
|
||||
clutter_stage_set_key_focus (CLUTTER_STAGE (stage), actor);
|
||||
break;
|
||||
case CLUTTER_SCROLL:
|
||||
g_print ("[%s] BUTTON SCROLL (direction:%s)",
|
||||
@ -263,21 +263,15 @@ input_cb (ClutterActor *actor,
|
||||
G_MODULE_EXPORT int
|
||||
test_events_main (int argc, char *argv[])
|
||||
{
|
||||
ClutterActor *stage, *actor, *focus_box, *group;
|
||||
ClutterColor rcol = { 0xff, 0, 0, 0xff },
|
||||
bcol = { 0, 0, 0xff, 0xff },
|
||||
gcol = { 0, 0xff, 0, 0xff },
|
||||
ycol = { 0xff, 0xff, 0, 0xff },
|
||||
ncol = { 0, 0, 0, 0xff },
|
||||
xcol = { 0xff, 0, 0xff, 0xff };
|
||||
ClutterActor *stage, *actor, *focus_box, *group;
|
||||
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Events");
|
||||
clutter_actor_set_name (stage, "Stage");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
g_signal_connect (stage, "event", G_CALLBACK (input_cb), "stage");
|
||||
g_signal_connect (stage, "fullscreen",
|
||||
G_CALLBACK (stage_state_cb), "fullscreen");
|
||||
@ -287,13 +281,12 @@ test_events_main (int argc, char *argv[])
|
||||
G_CALLBACK (stage_state_cb), "activate");
|
||||
g_signal_connect (stage, "deactivate",
|
||||
G_CALLBACK (stage_state_cb), "deactivate");
|
||||
/*g_signal_connect (stage, "captured-event", G_CALLBACK (capture_cb), NULL);*/
|
||||
|
||||
focus_box = clutter_rectangle_new_with_color (&ncol);
|
||||
focus_box = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black);
|
||||
clutter_actor_set_name (focus_box, "Focus Box");
|
||||
clutter_container_add (CLUTTER_CONTAINER(stage), focus_box, NULL);
|
||||
|
||||
actor = clutter_rectangle_new_with_color (&rcol);
|
||||
actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Red);
|
||||
clutter_actor_set_name (actor, "Red Box");
|
||||
clutter_actor_set_size (actor, 100, 100);
|
||||
clutter_actor_set_position (actor, 100, 100);
|
||||
@ -308,7 +301,7 @@ test_events_main (int argc, char *argv[])
|
||||
|
||||
clutter_stage_set_key_focus (CLUTTER_STAGE (stage), actor);
|
||||
|
||||
actor = clutter_rectangle_new_with_color (&gcol);
|
||||
actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Green);
|
||||
clutter_actor_set_name (actor, "Green Box");
|
||||
clutter_actor_set_size (actor, 100, 100);
|
||||
clutter_actor_set_position (actor, 250, 100);
|
||||
@ -319,7 +312,7 @@ test_events_main (int argc, char *argv[])
|
||||
focus_box);
|
||||
g_signal_connect (actor, "captured-event", G_CALLBACK (capture_cb), NULL);
|
||||
|
||||
actor = clutter_rectangle_new_with_color (&bcol);
|
||||
actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Blue);
|
||||
clutter_actor_set_name (actor, "Blue Box");
|
||||
clutter_actor_set_size (actor, 100, 100);
|
||||
clutter_actor_set_position (actor, 400, 100);
|
||||
@ -333,7 +326,7 @@ test_events_main (int argc, char *argv[])
|
||||
G_CALLBACK (blue_button_cb), NULL);
|
||||
|
||||
/* non reactive */
|
||||
actor = clutter_rectangle_new_with_color (&ncol);
|
||||
actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black);
|
||||
clutter_actor_set_name (actor, "Black Box");
|
||||
clutter_actor_set_size (actor, 400, 50);
|
||||
clutter_actor_set_position (actor, 100, 250);
|
||||
@ -345,7 +338,7 @@ test_events_main (int argc, char *argv[])
|
||||
focus_box);
|
||||
|
||||
/* non reactive group, with reactive child */
|
||||
actor = clutter_rectangle_new_with_color (&ycol);
|
||||
actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Yellow);
|
||||
clutter_actor_set_name (actor, "Yellow Box");
|
||||
clutter_actor_set_size (actor, 100, 100);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
@ -360,7 +353,7 @@ test_events_main (int argc, char *argv[])
|
||||
clutter_actor_show_all (group);
|
||||
|
||||
/* border actor */
|
||||
actor = clutter_rectangle_new_with_color (&xcol);
|
||||
actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Magenta);
|
||||
clutter_actor_set_name (actor, "Border Box");
|
||||
clutter_actor_set_size (actor, 100, 100);
|
||||
clutter_actor_set_position (actor,
|
||||
@ -376,3 +369,9 @@ test_events_main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_events_describe (void)
|
||||
{
|
||||
return "Event handling and propagation.";
|
||||
}
|
||||
|
@ -55,9 +55,11 @@ test_fbo_main (int argc, char *argv[])
|
||||
if (clutter_feature_available (CLUTTER_FEATURE_OFFSCREEN) == FALSE)
|
||||
g_error("This test requires CLUTTER_FEATURE_OFFSCREEN");
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &blue);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Texture from Actor");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
/* Create the first source */
|
||||
onscreen_source = make_source();
|
||||
@ -97,3 +99,9 @@ test_fbo_main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_fbo_describe (void)
|
||||
{
|
||||
return "Create a texture from an actor.";
|
||||
}
|
||||
|
@ -90,10 +90,11 @@ test_flow_layout_main (int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Flow Layout");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
layout = clutter_flow_layout_new (vertical ? CLUTTER_FLOW_VERTICAL
|
||||
: CLUTTER_FLOW_HORIZONTAL);
|
||||
@ -154,3 +155,9 @@ test_flow_layout_main (int argc, char *argv[])
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_flow_layout_describe (void)
|
||||
{
|
||||
return "FlowLayout layout manager example";
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ on_unfullscreen (ClutterStage *stage)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
toggle_fullscreen (gpointer dummy)
|
||||
toggle_fullscreen (gpointer data)
|
||||
{
|
||||
ClutterActor *stage = clutter_stage_get_default ();
|
||||
ClutterActor *stage = data;
|
||||
gboolean is_fullscreen = FALSE;
|
||||
|
||||
g_object_get (G_OBJECT (stage), "fullscreen-set", &is_fullscreen, NULL);
|
||||
@ -60,7 +60,7 @@ toggle_fullscreen (gpointer dummy)
|
||||
|
||||
case DONE:
|
||||
g_debug ("done: is_fullscreen := %s", is_fullscreen ? "true" : "false");
|
||||
clutter_main_quit ();
|
||||
clutter_actor_destroy (stage);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -75,13 +75,17 @@ test_fullscreen_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Fullscreen");
|
||||
g_signal_connect (stage,
|
||||
"fullscreen", G_CALLBACK (on_fullscreen),
|
||||
NULL);
|
||||
g_signal_connect (stage,
|
||||
"unfullscreen", G_CALLBACK (on_unfullscreen),
|
||||
NULL);
|
||||
g_signal_connect (stage,
|
||||
"destroy", G_CALLBACK (clutter_main_quit),
|
||||
NULL);
|
||||
|
||||
clutter_stage_set_fullscreen (CLUTTER_STAGE (stage), TRUE);
|
||||
clutter_actor_show (stage);
|
||||
@ -91,9 +95,15 @@ test_fullscreen_main (int argc, char *argv[])
|
||||
clutter_actor_get_height (stage),
|
||||
CLUTTER_ACTOR_IS_MAPPED (stage) ? "true" : "false");
|
||||
|
||||
g_timeout_add (1000, toggle_fullscreen, NULL);
|
||||
clutter_threads_add_timeout (1000, toggle_fullscreen, stage);
|
||||
|
||||
clutter_main ();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_fullscreen_describe (void)
|
||||
{
|
||||
return "Check behaviour of the Stage during fullscreen.";
|
||||
}
|
||||
|
@ -170,9 +170,11 @@ test_grab_main (int argc, char *argv[])
|
||||
g_print ("Green box: toggle per actor motion events.\n\n");
|
||||
g_print ("Cyan box: toggle grab (from cyan box) for keyboard events.\n\n");
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
g_signal_connect (stage, "event", G_CALLBACK (debug_event_cb), "stage");
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Grabs");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
g_signal_connect (stage, "event",
|
||||
G_CALLBACK (debug_event_cb), "stage");
|
||||
g_signal_connect (stage, "fullscreen",
|
||||
G_CALLBACK (stage_state_cb), "fullscreen");
|
||||
g_signal_connect (stage, "unfullscreen",
|
||||
@ -241,3 +243,9 @@ test_grab_main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_grab_describe (void)
|
||||
{
|
||||
return "Examples of using actor grabs";
|
||||
}
|
||||
|
@ -751,8 +751,10 @@ test_layout_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_actor_set_size (stage, 800, 600);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Layout");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
main_timeline = clutter_timeline_new (2000);
|
||||
clutter_timeline_set_loop (main_timeline, TRUE);
|
||||
@ -823,3 +825,9 @@ test_layout_main (int argc, char *argv[])
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_layout_describe (void)
|
||||
{
|
||||
return "Container implementing a layout policy.";
|
||||
}
|
||||
|
@ -149,7 +149,15 @@ main (int argc, char **argv)
|
||||
goto out;
|
||||
}
|
||||
|
||||
n_unit_names = g_strv_length (unit_names);
|
||||
if (unit_names != NULL)
|
||||
n_unit_names = g_strv_length (unit_names);
|
||||
else
|
||||
{
|
||||
g_print ("Usage: test-interactive <unit_test>\n");
|
||||
ret = EXIT_FAILURE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < n_unit_names; i++)
|
||||
{
|
||||
const char *unit_name = unit_names[i];
|
||||
|
@ -117,10 +117,12 @@ test_multistage_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage_default = clutter_stage_get_default ();
|
||||
stage_default = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage_default), "Default Stage");
|
||||
clutter_actor_set_name (stage_default, "Default Stage");
|
||||
|
||||
g_signal_connect (stage_default, "destroy",
|
||||
G_CALLBACK (clutter_main_quit),
|
||||
NULL);
|
||||
g_signal_connect (stage_default, "button-press-event",
|
||||
G_CALLBACK (on_button_press),
|
||||
NULL);
|
||||
|
@ -32,6 +32,8 @@ typedef struct SuperOH
|
||||
ClutterBehaviour *scaler_2;
|
||||
ClutterTimeline *timeline;
|
||||
|
||||
guint frame_id;
|
||||
|
||||
gboolean *paint_guards;
|
||||
} SuperOH;
|
||||
|
||||
@ -187,6 +189,16 @@ hand_post_paint (ClutterActor *actor,
|
||||
oh->paint_guards[actor_num] = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
stop_and_quit (ClutterActor *actor,
|
||||
SuperOH *oh)
|
||||
{
|
||||
g_signal_handler_disconnect (oh->timeline, oh->frame_id);
|
||||
clutter_timeline_stop (oh->timeline);
|
||||
|
||||
clutter_main_quit ();
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT int
|
||||
test_paint_wrapper_main (int argc, char *argv[])
|
||||
{
|
||||
@ -217,7 +229,9 @@ test_paint_wrapper_main (int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
oh = g_new(SuperOH, 1);
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
clutter_actor_set_size (stage, 800, 600);
|
||||
|
||||
if (use_alpha != 255)
|
||||
@ -228,8 +242,8 @@ test_paint_wrapper_main (int argc, char *argv[])
|
||||
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Paint Test");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (stop_and_quit), oh);
|
||||
|
||||
oh = g_new(SuperOH, 1);
|
||||
oh->stage = stage;
|
||||
|
||||
/* Create a timeline to manage animation */
|
||||
@ -237,7 +251,8 @@ test_paint_wrapper_main (int argc, char *argv[])
|
||||
clutter_timeline_set_loop (oh->timeline, TRUE);
|
||||
|
||||
/* fire a callback for frame change */
|
||||
g_signal_connect (oh->timeline, "new-frame", G_CALLBACK (frame_cb), oh);
|
||||
oh->frame_id =
|
||||
g_signal_connect (oh->timeline, "new-frame", G_CALLBACK (frame_cb), oh);
|
||||
|
||||
/* Set up some behaviours to handle scaling */
|
||||
alpha = clutter_alpha_new_with_func (oh->timeline, my_sine_wave, NULL, NULL);
|
||||
@ -347,3 +362,9 @@ test_paint_wrapper_main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_paint_wrapper_describe (void)
|
||||
{
|
||||
return "Wrap an actor's paint cycle for pre and post processing.";
|
||||
}
|
||||
|
@ -235,9 +235,11 @@ test_pixmap_main (int argc, char **argv)
|
||||
|
||||
XMapWindow (xdpy, win_remote);
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_actor_set_position (stage, 0, 150);
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &gry);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "X11 Texture from Pixmap");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
timeline = clutter_timeline_new (5000);
|
||||
g_signal_connect (timeline,
|
||||
@ -315,3 +317,9 @@ test_pixmap_main (int argc, char **argv)
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_pixmap_describe (void)
|
||||
{
|
||||
return "GLX Texture from pixmap extension support.";
|
||||
}
|
||||
|
@ -59,10 +59,11 @@ test_scale_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Scaling");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
clutter_actor_set_size (stage, 300, 300);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
rect = clutter_rectangle_new_with_color (&rect_color);
|
||||
clutter_actor_set_size (rect, 100, 100);
|
||||
@ -113,3 +114,9 @@ test_scale_main (int argc, char *argv[])
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_scale_describe (void)
|
||||
{
|
||||
return "Scaling animation and scaling center changes";
|
||||
}
|
||||
|
@ -137,7 +137,9 @@ test_stage_read_pixels_main (int argc, char **argv)
|
||||
return 1;
|
||||
|
||||
data.idle_source = 0;
|
||||
data.stage = clutter_stage_get_default ();
|
||||
data.stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (data.stage), "Read Pixels");
|
||||
g_signal_connect (data.stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
data.tex = make_tex ();
|
||||
data.box = make_box ();
|
||||
@ -158,3 +160,9 @@ test_stage_read_pixels_main (int argc, char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_stage_read_pixels_describe (void)
|
||||
{
|
||||
return "Read back pixels from a Stage.";
|
||||
}
|
||||
|
@ -44,7 +44,9 @@ test_stage_sizing_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Stage Sizing");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
label = clutter_text_new_with_text ("Sans 16", "Toggle fullscreen");
|
||||
rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_LightScarletRed);
|
||||
@ -107,3 +109,9 @@ test_stage_sizing_main (int argc, char *argv[])
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_stage_sizing_describe (void)
|
||||
{
|
||||
return "Check stage sizing policies.";
|
||||
}
|
||||
|
@ -52,14 +52,17 @@ test_state_animator_main (gint argc,
|
||||
ClutterActor *stage;
|
||||
ClutterActor *rects[40];
|
||||
gint i;
|
||||
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "State and Animator");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
for (i=0; i<2; i++)
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
rects[i]=new_rect (255 *(i * 1.0/40), 50, 160, 255);
|
||||
rects[i] = new_rect (255 * (i * 1.0 / 40), 50, 160, 255);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rects[i]);
|
||||
clutter_actor_set_anchor_point (rects[i], 64, 64);
|
||||
clutter_actor_set_position (rects[i], 320.0, 240.0);
|
||||
@ -133,3 +136,9 @@ test_state_animator_main (gint argc,
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_state_animator_describe (void)
|
||||
{
|
||||
return "Animate using the State and Animator classes.";
|
||||
}
|
||||
|
@ -92,24 +92,26 @@ G_MODULE_EXPORT gint
|
||||
test_state_main (gint argc,
|
||||
gchar **argv)
|
||||
{
|
||||
ClutterColor black={0,0,0,0xff};
|
||||
ClutterActor *stage;
|
||||
ClutterState *layout_state;
|
||||
gint i;
|
||||
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
layout_state = clutter_state_new ();
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &black);
|
||||
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Machine");
|
||||
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
g_signal_connect (stage, "button-press-event",
|
||||
G_CALLBACK (press_event), layout_state);
|
||||
g_signal_connect (stage, "button-release-event",
|
||||
G_CALLBACK (release_event), layout_state);
|
||||
|
||||
for (i=0; i<TOTAL; i++)
|
||||
for (i = 0; i < TOTAL; i++)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
ClutterState *a_state;
|
||||
@ -117,8 +119,8 @@ test_state_main (gint argc,
|
||||
int row = i/COLS;
|
||||
int col = i%COLS;
|
||||
|
||||
actor = new_rect (255 * ( 1.0*col/COLS), 50,
|
||||
255 * ( 1.0*row/ROWS), 255);
|
||||
actor = new_rect (255 * (1.0 * col / COLS), 50,
|
||||
255 * (1.0 * row / ROWS), 255);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
|
||||
clutter_actor_set_position (actor, 320.0, 240.0);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
@ -187,7 +189,14 @@ test_state_main (gint argc,
|
||||
clutter_state_set_state (layout_state, "active");
|
||||
|
||||
clutter_main ();
|
||||
|
||||
g_object_unref (layout_state);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_state_describe (void)
|
||||
{
|
||||
return "Animating using the State class.";
|
||||
}
|
||||
|
@ -98,9 +98,10 @@ test_swipe_action_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Swipe action test");
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Swipe action");
|
||||
clutter_actor_set_size (stage, 640, 480);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_Red);
|
||||
clutter_actor_set_name (rect, "Vertical swipes");
|
||||
@ -185,3 +186,9 @@ test_swipe_action_main (int argc, char *argv[])
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_swipe_action_describe (void)
|
||||
{
|
||||
return "Swipe gesture recognizer.";
|
||||
}
|
||||
|
@ -171,10 +171,11 @@ test_table_layout_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Table Layout");
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
clutter_actor_set_size (stage, 640, 480);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
layout = clutter_table_layout_new ();
|
||||
clutter_table_layout_set_column_spacing (CLUTTER_TABLE_LAYOUT (layout), 10);
|
||||
@ -278,5 +279,5 @@ test_table_layout_main (int argc, char *argv[])
|
||||
G_MODULE_EXPORT const char *
|
||||
test_table_layout_describe (void)
|
||||
{
|
||||
return "Table layout manager";
|
||||
return "TableLayout layout manager example.";
|
||||
}
|
||||
|
@ -16,16 +16,16 @@ test_text_main (gint argc,
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterActor *text;
|
||||
ClutterColor text_color = { 0x33, 0xff, 0x33, 0xff };
|
||||
ClutterColor cursor_color = { 0xff, 0x33, 0x33, 0xff };
|
||||
ClutterColor background_color = { 0x00, 0x00, 0x00, 0xff };
|
||||
ClutterColor selected_text_color = { 0x00, 0x00, 0xff, 0xff };
|
||||
ClutterColor text_color = { 0x33, 0xff, 0x33, 0xff };
|
||||
ClutterColor cursor_color = { 0xff, 0x33, 0x33, 0xff };
|
||||
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &background_color);
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Text Editing");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
text = clutter_text_new_full (FONT, "·", &text_color);
|
||||
|
||||
@ -40,7 +40,7 @@ test_text_main (gint argc,
|
||||
clutter_text_set_editable (CLUTTER_TEXT (text), TRUE);
|
||||
clutter_text_set_selectable (CLUTTER_TEXT (text), TRUE);
|
||||
clutter_text_set_cursor_color (CLUTTER_TEXT (text), &cursor_color);
|
||||
clutter_text_set_selected_text_color (CLUTTER_TEXT (text), &selected_text_color);
|
||||
clutter_text_set_selected_text_color (CLUTTER_TEXT (text), CLUTTER_COLOR_Blue);
|
||||
|
||||
if (argv[1])
|
||||
{
|
||||
@ -68,3 +68,9 @@ test_text_main (gint argc,
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_text_describe (void)
|
||||
{
|
||||
return "Multi-line text editing.";
|
||||
}
|
||||
|
@ -55,11 +55,13 @@ test_texture_quality_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
clutter_stage_set_use_fog (CLUTTER_STAGE (stage), TRUE);
|
||||
clutter_stage_set_fog (CLUTTER_STAGE (stage), &stage_fog);
|
||||
|
||||
g_signal_connect (stage,
|
||||
"destroy", G_CALLBACK (clutter_main_quit),
|
||||
NULL);
|
||||
g_signal_connect (stage,
|
||||
"button-press-event", G_CALLBACK (clutter_main_quit),
|
||||
NULL);
|
||||
@ -97,7 +99,7 @@ test_texture_quality_main (int argc, char *argv[])
|
||||
clutter_actor_show (stage);
|
||||
clutter_timeline_start (timeline);
|
||||
|
||||
g_timeout_add (10000, change_filter, image);
|
||||
clutter_threads_add_timeout (10000, change_filter, image);
|
||||
|
||||
clutter_main ();
|
||||
|
||||
@ -106,3 +108,9 @@ test_texture_quality_main (int argc, char *argv[])
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_texture_quality_describe (void)
|
||||
{
|
||||
return "Change the texture filtering quality.";
|
||||
}
|
||||
|
@ -47,6 +47,12 @@ make_rgba_data (int width, int height, int bpp, int has_alpha, int *rowstride_p)
|
||||
return pixels;
|
||||
}
|
||||
|
||||
static void
|
||||
exit_on_destroy (ClutterActor *actor)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
#define SPIN() while (g_main_context_pending (NULL)) \
|
||||
g_main_context_iteration (NULL, FALSE);
|
||||
|
||||
@ -60,8 +66,9 @@ test_textures_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_actor_show_all (CLUTTER_ACTOR (stage));
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (exit_on_destroy), NULL);
|
||||
|
||||
SPIN();
|
||||
|
||||
|
@ -104,10 +104,11 @@ test_unproject_main (int argc, char *argv[])
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Unprojecting events");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
|
||||
clutter_actor_set_size (stage, 640, 480);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
rect = clutter_rectangle_new_with_color (&white);
|
||||
clutter_actor_set_size (rect, RECT_W, RECT_H);
|
||||
@ -146,8 +147,11 @@ test_unproject_main (int argc, char *argv[])
|
||||
|
||||
clutter_main();
|
||||
|
||||
test_rectangle = NULL;
|
||||
label = NULL;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_unproject_describe (void)
|
||||
{
|
||||
return "Transform stage coordinates into actor coordinates.";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user