tests/*: Use symbolic constants for sources and events
And make sure to use clutter_threads_add_* instead of the bare g_*_add().
This commit is contained in:
parent
b2bf2dbb08
commit
9206bd7627
23 changed files with 88 additions and 82 deletions
|
@ -668,7 +668,7 @@ idle_cb (gpointer data)
|
||||||
|
|
||||||
clutter_main_quit ();
|
clutter_main_quit ();
|
||||||
|
|
||||||
return FALSE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -691,7 +691,7 @@ actor_anchors (void)
|
||||||
|
|
||||||
/* Run the tests in a low priority idle function so that we can be
|
/* Run the tests in a low priority idle function so that we can be
|
||||||
sure the stage is correctly setup */
|
sure the stage is correctly setup */
|
||||||
g_idle_add_full (G_PRIORITY_LOW, idle_cb, &state, NULL);
|
clutter_threads_add_idle_full (G_PRIORITY_LOW, idle_cb, &state, NULL);
|
||||||
|
|
||||||
clutter_actor_show (stage);
|
clutter_actor_show (stage);
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ idle_cb (gpointer data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -180,7 +180,7 @@ test_clutter_cairo_texture (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 (idle_cb, &state);
|
idle_source = clutter_threads_add_idle (idle_cb, &state);
|
||||||
paint_handler = g_signal_connect_after (state.stage, "paint",
|
paint_handler = g_signal_connect_after (state.stage, "paint",
|
||||||
G_CALLBACK (paint_cb), &state);
|
G_CALLBACK (paint_cb), &state);
|
||||||
|
|
||||||
|
|
|
@ -253,7 +253,7 @@ queue_redraw (gpointer stage)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglHandle
|
static CoglHandle
|
||||||
|
@ -319,7 +319,7 @@ test_cogl_backface_culling (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, stage);
|
idle_source = clutter_threads_add_idle (queue_redraw, stage);
|
||||||
|
|
||||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
||||||
|
|
||||||
|
|
|
@ -393,7 +393,7 @@ queue_redraw (gpointer stage)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -416,7 +416,7 @@ test_cogl_blend_strings (TestConformSimpleFixture *fixture,
|
||||||
/* We force continuous redrawing incase someone comments out the
|
/* We force continuous redrawing incase someone comments out the
|
||||||
* clutter_main_quit and wants visual feedback for the test since we
|
* clutter_main_quit and wants visual feedback for the test since we
|
||||||
* wont be doing anything else that will trigger redrawing. */
|
* wont be doing anything else that will trigger redrawing. */
|
||||||
idle_source = g_idle_add (queue_redraw, stage);
|
idle_source = clutter_threads_add_idle (queue_redraw, stage);
|
||||||
|
|
||||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,7 @@ queue_redraw (gpointer stage)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -319,7 +319,7 @@ test_cogl_depth_test (TestConformSimpleFixture *fixture,
|
||||||
/* We force continuous redrawing incase someone comments out the
|
/* We force continuous redrawing incase someone comments out the
|
||||||
* clutter_main_quit and wants visual feedback for the test since we
|
* clutter_main_quit and wants visual feedback for the test since we
|
||||||
* wont be doing anything else that will trigger redrawing. */
|
* wont be doing anything else that will trigger redrawing. */
|
||||||
idle_source = g_idle_add (queue_redraw, stage);
|
idle_source = clutter_threads_add_idle (queue_redraw, stage);
|
||||||
|
|
||||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ queue_redraw (gpointer stage)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -344,7 +344,7 @@ test_cogl_materials (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, stage);
|
idle_source = clutter_threads_add_idle (queue_redraw, stage);
|
||||||
|
|
||||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ queue_redraw (gpointer stage)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -191,7 +191,7 @@ test_cogl_multitexture (TestConformSimpleFixture *fixture,
|
||||||
/* We force continuous redrawing incase someone comments out the
|
/* We force continuous redrawing incase someone comments out the
|
||||||
* clutter_main_quit and wants visual feedback for the test since we
|
* clutter_main_quit and wants visual feedback for the test since we
|
||||||
* wont be doing anything else that will trigger redrawing. */
|
* wont be doing anything else that will trigger redrawing. */
|
||||||
idle_source = g_idle_add (queue_redraw, stage);
|
idle_source = clutter_threads_add_idle (queue_redraw, stage);
|
||||||
|
|
||||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ queue_redraw (gpointer stage)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglHandle
|
static CoglHandle
|
||||||
|
@ -221,7 +221,7 @@ test_cogl_npot_texture (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, stage);
|
idle_source = clutter_threads_add_idle (queue_redraw, stage);
|
||||||
|
|
||||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ queue_redraw (gpointer stage)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -148,7 +148,7 @@ test_cogl_offscreen (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, stage);
|
idle_source = clutter_threads_add_idle (queue_redraw, stage);
|
||||||
g_signal_connect_after (stage, "paint", G_CALLBACK (on_paint), NULL);
|
g_signal_connect_after (stage, "paint", G_CALLBACK (on_paint), NULL);
|
||||||
|
|
||||||
clutter_actor_show (stage);
|
clutter_actor_show (stage);
|
||||||
|
|
|
@ -290,7 +290,7 @@ timeout_cb (gpointer user_data)
|
||||||
|
|
||||||
clutter_main_quit ();
|
clutter_main_quit ();
|
||||||
|
|
||||||
return FALSE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -333,7 +333,7 @@ test_offscreen_redirect (TestConformSimpleFixture *fixture,
|
||||||
|
|
||||||
/* Start the test after a short delay to allow the stage to
|
/* Start the test after a short delay to allow the stage to
|
||||||
render its initial frames without affecting the results */
|
render its initial frames without affecting the results */
|
||||||
g_timeout_add_full (G_PRIORITY_LOW, 250, timeout_cb, &data, NULL);
|
clutter_threads_add_timeout_full (G_PRIORITY_LOW, 250, timeout_cb, &data, NULL);
|
||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,9 @@ shift_effect_init (ShiftEffect *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
on_timeout (State *state)
|
on_timeout (gpointer data)
|
||||||
{
|
{
|
||||||
|
State *state = data;
|
||||||
int test_num = 0;
|
int test_num = 0;
|
||||||
int y, x;
|
int y, x;
|
||||||
ClutterActor *over_actor = NULL;
|
ClutterActor *over_actor = NULL;
|
||||||
|
@ -235,7 +236,7 @@ on_timeout (State *state)
|
||||||
|
|
||||||
clutter_main_quit ();
|
clutter_main_quit ();
|
||||||
|
|
||||||
return FALSE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -273,7 +274,7 @@ actor_picking (void)
|
||||||
|
|
||||||
clutter_actor_show (state.stage);
|
clutter_actor_show (state.stage);
|
||||||
|
|
||||||
g_idle_add ((GSourceFunc) on_timeout, &state);
|
clutter_threads_add_idle (on_timeout, &state);
|
||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ queue_redraw (gpointer stage)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -227,7 +227,7 @@ 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. */
|
||||||
g_idle_add (queue_redraw, state.stage);
|
clutter_threads_add_idle (queue_redraw, state.stage);
|
||||||
g_signal_connect_after (state.stage, "paint", G_CALLBACK (on_paint), &state);
|
g_signal_connect_after (state.stage, "paint", G_CALLBACK (on_paint), &state);
|
||||||
|
|
||||||
clutter_actor_show_all (state.stage);
|
clutter_actor_show_all (state.stage);
|
||||||
|
|
|
@ -14,8 +14,10 @@ typedef struct _TestState
|
||||||
} TestState;
|
} TestState;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
watchdog_timeout (TestState *state)
|
watchdog_timeout (gpointer data)
|
||||||
{
|
{
|
||||||
|
TestState *state = data;
|
||||||
|
|
||||||
g_test_message ("Watchdog timer kicking in");
|
g_test_message ("Watchdog timer kicking in");
|
||||||
g_test_message ("rewind_count=%i", state->rewind_count);
|
g_test_message ("rewind_count=%i", state->rewind_count);
|
||||||
if (state->rewind_count <= 3)
|
if (state->rewind_count <= 3)
|
||||||
|
@ -30,7 +32,7 @@ watchdog_timeout (TestState *state)
|
||||||
clutter_main_quit ();
|
clutter_main_quit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -77,9 +79,9 @@ timeline_rewind (void)
|
||||||
&state);
|
&state);
|
||||||
g_test_message ("Installing a watchdog timeout "
|
g_test_message ("Installing a watchdog timeout "
|
||||||
"to determine if this test hangs");
|
"to determine if this test hangs");
|
||||||
g_timeout_add (TEST_WATCHDOG_KICK_IN_SECONDS*1000,
|
clutter_threads_add_timeout (TEST_WATCHDOG_KICK_IN_SECONDS * 1000,
|
||||||
(GSourceFunc)watchdog_timeout,
|
watchdog_timeout,
|
||||||
&state);
|
&state);
|
||||||
state.rewind_count = 0;
|
state.rewind_count = 0;
|
||||||
|
|
||||||
clutter_timeline_start (state.timeline);
|
clutter_timeline_start (state.timeline);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <stdlib.h>
|
||||||
#include <clutter/clutter.h>
|
#include <clutter/clutter.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
|
@ -213,7 +214,7 @@ idle_cb (gpointer data)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (data);
|
clutter_actor_queue_redraw (data);
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_MODULE_EXPORT int
|
G_MODULE_EXPORT int
|
||||||
|
@ -226,7 +227,7 @@ test_cogl_point_sprites_main (int argc, char *argv[])
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||||
return 1;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
data.material = cogl_material_new ();
|
data.material = cogl_material_new ();
|
||||||
data.last_spark_time = g_timer_new ();
|
data.last_spark_time = g_timer_new ();
|
||||||
|
@ -267,7 +268,7 @@ test_cogl_point_sprites_main (int argc, char *argv[])
|
||||||
|
|
||||||
clutter_actor_show (stage);
|
clutter_actor_show (stage);
|
||||||
|
|
||||||
g_idle_add (idle_cb, stage);
|
clutter_threads_add_idle (idle_cb, stage);
|
||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
|
|
|
@ -309,13 +309,13 @@ button_release_cb (ClutterActor *actor,
|
||||||
|
|
||||||
set_shader_num (new_no);
|
set_shader_num (new_no);
|
||||||
|
|
||||||
return FALSE;
|
return CLUTTER_EVENT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
key_release_cb (ClutterActor *actor,
|
key_release_cb (ClutterActor *actor,
|
||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
void *user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
guint keysym = clutter_event_get_key_symbol (event);
|
guint keysym = clutter_event_get_key_symbol (event);
|
||||||
ClutterModifierType mods = clutter_event_get_state (event);
|
ClutterModifierType mods = clutter_event_get_state (event);
|
||||||
|
@ -324,11 +324,11 @@ key_release_cb (ClutterActor *actor,
|
||||||
((mods & CLUTTER_SHIFT_MASK) && keysym == CLUTTER_KEY_q))
|
((mods & CLUTTER_SHIFT_MASK) && keysym == CLUTTER_KEY_q))
|
||||||
clutter_main_quit ();
|
clutter_main_quit ();
|
||||||
|
|
||||||
return FALSE;
|
return CLUTTER_EVENT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
timeout_cb (void *user_data)
|
timeout_cb (gpointer user_data)
|
||||||
{
|
{
|
||||||
shader_no++;
|
shader_no++;
|
||||||
if (shader_no > (G_N_ELEMENTS (shaders) - 1))
|
if (shader_no > (G_N_ELEMENTS (shaders) - 1))
|
||||||
|
@ -336,15 +336,15 @@ timeout_cb (void *user_data)
|
||||||
|
|
||||||
set_shader_num (shader_no);
|
set_shader_num (shader_no);
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
idle_cb (void *data)
|
idle_cb (gpointer data)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (data);
|
clutter_actor_queue_redraw (data);
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -394,11 +394,11 @@ test_cogl_shader_arbfp_main (int argc, char *argv[])
|
||||||
g_signal_connect (stage, "delete-event",
|
g_signal_connect (stage, "delete-event",
|
||||||
G_CALLBACK (destroy_window_cb), NULL);
|
G_CALLBACK (destroy_window_cb), NULL);
|
||||||
|
|
||||||
timeout_id = g_timeout_add (1000, timeout_cb, NULL);
|
timeout_id = clutter_threads_add_timeout (1000, timeout_cb, NULL);
|
||||||
|
|
||||||
g_idle_add (idle_cb, stage);
|
clutter_threads_add_idle (idle_cb, stage);
|
||||||
|
|
||||||
clutter_actor_show_all (stage);
|
clutter_actor_show (stage);
|
||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
|
|
|
@ -180,10 +180,10 @@ static int shader_no = 0;
|
||||||
static void
|
static void
|
||||||
paint_cb (ClutterActor *actor)
|
paint_cb (ClutterActor *actor)
|
||||||
{
|
{
|
||||||
int stage_width = clutter_actor_get_width (actor);
|
float stage_width = clutter_actor_get_width (actor);
|
||||||
int stage_height = clutter_actor_get_height (actor);
|
float stage_height = clutter_actor_get_height (actor);
|
||||||
int image_width = cogl_texture_get_width (redhand);
|
float image_width = cogl_texture_get_width (redhand);
|
||||||
int image_height = cogl_texture_get_height (redhand);
|
float image_height = cogl_texture_get_height (redhand);
|
||||||
|
|
||||||
cogl_set_source (material);
|
cogl_set_source (material);
|
||||||
cogl_rectangle (stage_width/2.0f - image_width/2.0f,
|
cogl_rectangle (stage_width/2.0f - image_width/2.0f,
|
||||||
|
@ -237,7 +237,7 @@ set_shader_num (int new_no)
|
||||||
static gboolean
|
static gboolean
|
||||||
button_release_cb (ClutterActor *actor,
|
button_release_cb (ClutterActor *actor,
|
||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
void *data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
int new_no;
|
int new_no;
|
||||||
|
|
||||||
|
@ -264,13 +264,13 @@ button_release_cb (ClutterActor *actor,
|
||||||
|
|
||||||
set_shader_num (new_no);
|
set_shader_num (new_no);
|
||||||
|
|
||||||
return FALSE;
|
return CLUTTER_EVENT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
key_release_cb (ClutterActor *actor,
|
key_release_cb (ClutterActor *actor,
|
||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
void *user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
guint keysym = clutter_event_get_key_symbol (event);
|
guint keysym = clutter_event_get_key_symbol (event);
|
||||||
ClutterModifierType mods = clutter_event_get_state (event);
|
ClutterModifierType mods = clutter_event_get_state (event);
|
||||||
|
@ -279,11 +279,11 @@ key_release_cb (ClutterActor *actor,
|
||||||
((mods & CLUTTER_SHIFT_MASK) && keysym == CLUTTER_KEY_q))
|
((mods & CLUTTER_SHIFT_MASK) && keysym == CLUTTER_KEY_q))
|
||||||
clutter_main_quit ();
|
clutter_main_quit ();
|
||||||
|
|
||||||
return FALSE;
|
return CLUTTER_EVENT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
timeout_cb (void *user_data)
|
timeout_cb (gpointer user_data)
|
||||||
{
|
{
|
||||||
shader_no++;
|
shader_no++;
|
||||||
if (shader_no > (G_N_ELEMENTS (shaders) - 1))
|
if (shader_no > (G_N_ELEMENTS (shaders) - 1))
|
||||||
|
@ -291,24 +291,25 @@ timeout_cb (void *user_data)
|
||||||
|
|
||||||
set_shader_num (shader_no);
|
set_shader_num (shader_no);
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
idle_cb (void *data)
|
idle_cb (gpointer data)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (data);
|
clutter_actor_queue_redraw (data);
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
destroy_window_cb (ClutterStage *stage,
|
destroy_window_cb (ClutterStage *stage,
|
||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
void *user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
clutter_main_quit ();
|
clutter_main_quit ();
|
||||||
return TRUE;
|
|
||||||
|
return CLUTTER_EVENT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_MODULE_EXPORT int
|
G_MODULE_EXPORT int
|
||||||
|
@ -351,11 +352,11 @@ test_cogl_shader_glsl_main (int argc, char *argv[])
|
||||||
g_signal_connect (stage, "delete-event",
|
g_signal_connect (stage, "delete-event",
|
||||||
G_CALLBACK (destroy_window_cb), NULL);
|
G_CALLBACK (destroy_window_cb), NULL);
|
||||||
|
|
||||||
timeout_id = g_timeout_add (1000, timeout_cb, NULL);
|
timeout_id = clutter_threads_add_timeout (1000, timeout_cb, NULL);
|
||||||
|
|
||||||
g_idle_add (idle_cb, stage);
|
clutter_threads_add_idle (idle_cb, stage);
|
||||||
|
|
||||||
clutter_actor_show_all (stage);
|
clutter_actor_show (stage);
|
||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,14 @@ static ClutterActor *raise_actor[2];
|
||||||
static gboolean raise_no = 0;
|
static gboolean raise_no = 0;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
raise_top (gpointer ignored)
|
raise_top (gpointer ignored G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
ClutterActor *parent = clutter_actor_get_parent (raise_actor[raise_no]);
|
ClutterActor *parent = clutter_actor_get_parent (raise_actor[raise_no]);
|
||||||
|
|
||||||
clutter_actor_set_child_above_sibling (parent, raise_actor[raise_no], NULL);
|
clutter_actor_set_child_above_sibling (parent, raise_actor[raise_no], NULL);
|
||||||
raise_no = !raise_no;
|
raise_no = !raise_no;
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ClutterActor *
|
static ClutterActor *
|
||||||
|
@ -106,7 +106,6 @@ janus_group (const gchar *front_text,
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
G_MODULE_EXPORT gint
|
G_MODULE_EXPORT gint
|
||||||
test_depth_main (int argc, char *argv[])
|
test_depth_main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -118,7 +117,7 @@ test_depth_main (int argc, char *argv[])
|
||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||||
return 1;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
stage = clutter_stage_new ();
|
stage = clutter_stage_new ();
|
||||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Depth Test");
|
clutter_stage_set_title (CLUTTER_STAGE (stage), "Depth Test");
|
||||||
|
@ -153,7 +152,6 @@ test_depth_main (int argc, char *argv[])
|
||||||
clutter_container_add (CLUTTER_CONTAINER (group), hand, rect, NULL);
|
clutter_container_add (CLUTTER_CONTAINER (group), hand, rect, NULL);
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);
|
||||||
|
|
||||||
/* 3 seconds, at 60 fps */
|
|
||||||
timeline = clutter_timeline_new (3000);
|
timeline = clutter_timeline_new (3000);
|
||||||
g_signal_connect (timeline,
|
g_signal_connect (timeline,
|
||||||
"completed", G_CALLBACK (timeline_completed),
|
"completed", G_CALLBACK (timeline_completed),
|
||||||
|
@ -200,7 +198,7 @@ test_depth_main (int argc, char *argv[])
|
||||||
|
|
||||||
raise_actor[0] = rect;
|
raise_actor[0] = rect;
|
||||||
raise_actor[1] = hand;
|
raise_actor[1] = hand;
|
||||||
g_timeout_add (2000, raise_top, NULL);
|
clutter_threads_add_timeout (2000, raise_top, NULL);
|
||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
|
|
|
@ -89,9 +89,11 @@ stage_key_release_cb (ClutterActor *actor,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
draw_arc (Pixmap pixmap)
|
draw_arc (data)
|
||||||
{
|
{
|
||||||
|
Pixmap pixmap = GPOINTER_TO_UINT (data);
|
||||||
Display *dpy = clutter_x11_get_default_display ();
|
Display *dpy = clutter_x11_get_default_display ();
|
||||||
|
|
||||||
static GC gc = None;
|
static GC gc = None;
|
||||||
static int x = 100, y = 100;
|
static int x = 100, y = 100;
|
||||||
|
|
||||||
|
@ -116,7 +118,7 @@ draw_arc (Pixmap pixmap)
|
||||||
x -= 5;
|
x -= 5;
|
||||||
y -= 5;
|
y -= 5;
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -124,9 +126,9 @@ stage_button_press_cb (ClutterActor *actor,
|
||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
draw_arc ((Pixmap)data);
|
draw_arc (GPOINTER_TO_UINT (data));
|
||||||
|
|
||||||
return FALSE;
|
return CLUTTER_EVENT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pixmap
|
Pixmap
|
||||||
|
@ -311,7 +313,7 @@ test_pixmap_main (int argc, char **argv)
|
||||||
if (!disable_animation)
|
if (!disable_animation)
|
||||||
clutter_timeline_start (timeline);
|
clutter_timeline_start (timeline);
|
||||||
|
|
||||||
g_timeout_add_seconds (1, (GSourceFunc)draw_arc, GUINT_TO_POINTER (pixmap));
|
clutter_threads_add_timeout (1000, draw_arc, GUINT_TO_POINTER (pixmap));
|
||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ button_release_cb (ClutterActor *actor,
|
||||||
|
|
||||||
set_shader_num (actor, new_no);
|
set_shader_num (actor, new_no);
|
||||||
|
|
||||||
return FALSE;
|
return CLUTTER_EVENT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef COGL_HAS_GLES2
|
#ifdef COGL_HAS_GLES2
|
||||||
|
@ -291,7 +291,7 @@ timeout_cb (gpointer data)
|
||||||
|
|
||||||
set_shader_num (CLUTTER_ACTOR (data), new_no);
|
set_shader_num (CLUTTER_ACTOR (data), new_no);
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
#endif /* COGL_HAS_GLES2 */
|
#endif /* COGL_HAS_GLES2 */
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ test_shader_main (gint argc, gchar *argv[])
|
||||||
#ifdef COGL_HAS_GLES2
|
#ifdef COGL_HAS_GLES2
|
||||||
/* On an embedded platform it is difficult to right click so we will
|
/* On an embedded platform it is difficult to right click so we will
|
||||||
cycle through the shaders automatically */
|
cycle through the shaders automatically */
|
||||||
g_timeout_add_seconds (3, timeout_cb, actor);
|
clutter_threads_add_timeout (3000, timeout_cb, actor);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Show everying ( and map window ) */
|
/* Show everying ( and map window ) */
|
||||||
|
|
|
@ -40,7 +40,7 @@ queue_redraw (gpointer stage)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gunichar
|
static gunichar
|
||||||
|
@ -179,7 +179,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
clutter_actor_show_all (stage);
|
clutter_actor_show_all (stage);
|
||||||
|
|
||||||
g_idle_add (queue_redraw, stage);
|
clutter_threads_add_idle (queue_redraw, stage);
|
||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ queue_redraw (gpointer stage)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||||
|
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -60,7 +60,7 @@ main (int argc, char *argv[])
|
||||||
clutter_actor_set_size (group, STAGE_WIDTH, STAGE_WIDTH);
|
clutter_actor_set_size (group, STAGE_WIDTH, STAGE_WIDTH);
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
||||||
|
|
||||||
g_idle_add (queue_redraw, stage);
|
clutter_threads_add_idle (queue_redraw, stage);
|
||||||
|
|
||||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), NULL);
|
g_signal_connect (group, "paint", G_CALLBACK (on_paint), NULL);
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ void clutter_perf_fps_start (ClutterStage *stage)
|
||||||
|
|
||||||
void clutter_perf_fake_mouse (ClutterStage *stage)
|
void clutter_perf_fake_mouse (ClutterStage *stage)
|
||||||
{
|
{
|
||||||
g_timeout_add (1000/60, perf_fake_mouse_cb, stage);
|
clutter_threads_add_timeout (1000/60, perf_fake_mouse_cb, stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clutter_perf_fps_report (const gchar *id)
|
void clutter_perf_fps_report (const gchar *id)
|
||||||
|
@ -126,5 +126,5 @@ static gboolean perf_fake_mouse_cb (gpointer stage)
|
||||||
yd = CLAMP(yd, -1.3, 1.3);
|
yd = CLAMP(yd, -1.3, 1.3);
|
||||||
}
|
}
|
||||||
clutter_event_free (event);
|
clutter_event_free (event);
|
||||||
return TRUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ static gboolean
|
||||||
queue_redraw (gpointer stage)
|
queue_redraw (gpointer stage)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||||
return TRUE;
|
|
||||||
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gunichar
|
static gunichar
|
||||||
|
@ -158,7 +159,7 @@ main (int argc, char *argv[])
|
||||||
clutter_actor_show_all (stage);
|
clutter_actor_show_all (stage);
|
||||||
|
|
||||||
clutter_perf_fps_start (CLUTTER_STAGE (stage));
|
clutter_perf_fps_start (CLUTTER_STAGE (stage));
|
||||||
g_idle_add (queue_redraw, stage);
|
clutter_threads_add_idle (queue_redraw, stage);
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
clutter_perf_fps_report ("test-text-perf");
|
clutter_perf_fps_report ("test-text-perf");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue