Commit 9206bd76 authored by Emmanuele Bassi's avatar Emmanuele Bassi

tests/*: Use symbolic constants for sources and events

And make sure to use clutter_threads_add_* instead of the bare
g_*_add().
parent b2bf2dbb
......@@ -668,7 +668,7 @@ idle_cb (gpointer data)
clutter_main_quit ();
return FALSE;
return G_SOURCE_REMOVE;
}
void
......@@ -691,7 +691,7 @@ actor_anchors (void)
/* Run the tests in a low priority idle function so that we can be
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);
......
......@@ -157,7 +157,7 @@ idle_cb (gpointer data)
break;
}
return TRUE;
return G_SOURCE_CONTINUE;
}
void
......@@ -180,7 +180,7 @@ test_clutter_cairo_texture (TestConformSimpleFixture *fixture,
/* We force continuous redrawing of the stage, since we need to skip
* the first few frames, and we wont be doing anything else that
* 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",
G_CALLBACK (paint_cb), &state);
......
......@@ -253,7 +253,7 @@ queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
return G_SOURCE_CONTINUE;
}
static CoglHandle
......@@ -319,7 +319,7 @@ test_cogl_backface_culling (TestConformSimpleFixture *fixture,
/* We force continuous redrawing of the stage, since we need to skip
* the first few frames, and we 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);
......
......@@ -393,7 +393,7 @@ queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
return G_SOURCE_CONTINUE;
}
void
......@@ -416,7 +416,7 @@ test_cogl_blend_strings (TestConformSimpleFixture *fixture,
/* We force continuous redrawing incase someone comments out the
* clutter_main_quit and wants visual feedback for the test since we
* 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);
......
......@@ -296,7 +296,7 @@ queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
return G_SOURCE_CONTINUE;
}
void
......@@ -319,7 +319,7 @@ test_cogl_depth_test (TestConformSimpleFixture *fixture,
/* We force continuous redrawing incase someone comments out the
* clutter_main_quit and wants visual feedback for the test since we
* 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);
......
......@@ -319,7 +319,7 @@ queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
return G_SOURCE_CONTINUE;
}
void
......@@ -344,7 +344,7 @@ test_cogl_materials (TestConformSimpleFixture *fixture,
/* We force continuous redrawing of the stage, since we need to skip
* the first few frames, and we 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);
......
......@@ -169,7 +169,7 @@ queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
return G_SOURCE_CONTINUE;
}
void
......@@ -191,7 +191,7 @@ test_cogl_multitexture (TestConformSimpleFixture *fixture,
/* We force continuous redrawing incase someone comments out the
* clutter_main_quit and wants visual feedback for the test since we
* 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);
......
......@@ -122,7 +122,7 @@ queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
return G_SOURCE_CONTINUE;
}
static CoglHandle
......@@ -221,7 +221,7 @@ test_cogl_npot_texture (TestConformSimpleFixture *fixture,
/* We force continuous redrawing of the stage, since we need to skip
* the first few frames, and we 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);
......
......@@ -132,7 +132,7 @@ queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
return G_SOURCE_CONTINUE;
}
void
......@@ -148,7 +148,7 @@ test_cogl_offscreen (TestConformSimpleFixture *fixture,
/* We force continuous redrawing of the stage, since we need to skip
* the first few frames, and we 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_after (stage, "paint", G_CALLBACK (on_paint), NULL);
clutter_actor_show (stage);
......
......@@ -290,7 +290,7 @@ timeout_cb (gpointer user_data)
clutter_main_quit ();
return FALSE;
return G_SOURCE_REMOVE;
}
void
......@@ -333,7 +333,7 @@ test_offscreen_redirect (TestConformSimpleFixture *fixture,
/* Start the test after a short delay to allow the stage to
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 ();
......
......@@ -90,8 +90,9 @@ shift_effect_init (ShiftEffect *self)
}
static gboolean
on_timeout (State *state)
on_timeout (gpointer data)
{
State *state = data;
int test_num = 0;
int y, x;
ClutterActor *over_actor = NULL;
......@@ -235,7 +236,7 @@ on_timeout (State *state)
clutter_main_quit ();
return FALSE;
return G_SOURCE_REMOVE;
}
void
......@@ -273,7 +274,7 @@ actor_picking (void)
clutter_actor_show (state.stage);
g_idle_add ((GSourceFunc) on_timeout, &state);
clutter_threads_add_idle (on_timeout, &state);
clutter_main ();
......
......@@ -165,7 +165,7 @@ queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
return G_SOURCE_CONTINUE;
}
void
......@@ -227,7 +227,7 @@ test_texture_fbo (TestConformSimpleFixture *fixture,
/* We force continuous redrawing of the stage, since we need to skip
* the first few frames, and we wont be doing anything else that
* 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);
clutter_actor_show_all (state.stage);
......
......@@ -14,8 +14,10 @@ typedef struct _TestState
} TestState;
static gboolean
watchdog_timeout (TestState *state)
watchdog_timeout (gpointer data)
{
TestState *state = data;
g_test_message ("Watchdog timer kicking in");
g_test_message ("rewind_count=%i", state->rewind_count);
if (state->rewind_count <= 3)
......@@ -30,7 +32,7 @@ watchdog_timeout (TestState *state)
clutter_main_quit ();
}
return FALSE;
return G_SOURCE_REMOVE;
}
static void
......@@ -77,9 +79,9 @@ timeline_rewind (void)
&state);
g_test_message ("Installing a watchdog timeout "
"to determine if this test hangs");
g_timeout_add (TEST_WATCHDOG_KICK_IN_SECONDS*1000,
(GSourceFunc)watchdog_timeout,
&state);
clutter_threads_add_timeout (TEST_WATCHDOG_KICK_IN_SECONDS * 1000,
watchdog_timeout,
&state);
state.rewind_count = 0;
clutter_timeline_start (state.timeline);
......
#include <stdlib.h>
#include <clutter/clutter.h>
#include <math.h>
#include <gmodule.h>
......@@ -213,7 +214,7 @@ idle_cb (gpointer data)
{
clutter_actor_queue_redraw (data);
return TRUE;
return G_SOURCE_CONTINUE;
}
G_MODULE_EXPORT int
......@@ -226,7 +227,7 @@ test_cogl_point_sprites_main (int argc, char *argv[])
int i;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
return EXIT_FAILURE;
data.material = cogl_material_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);
g_idle_add (idle_cb, stage);
clutter_threads_add_idle (idle_cb, stage);
clutter_main ();
......
......@@ -309,13 +309,13 @@ button_release_cb (ClutterActor *actor,
set_shader_num (new_no);
return FALSE;
return CLUTTER_EVENT_STOP;
}
static gboolean
key_release_cb (ClutterActor *actor,
ClutterEvent *event,
void *user_data)
gpointer user_data)
{
guint keysym = clutter_event_get_key_symbol (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))
clutter_main_quit ();
return FALSE;
return CLUTTER_EVENT_STOP;
}
static gboolean
timeout_cb (void *user_data)
timeout_cb (gpointer user_data)
{
shader_no++;
if (shader_no > (G_N_ELEMENTS (shaders) - 1))
......@@ -336,15 +336,15 @@ timeout_cb (void *user_data)
set_shader_num (shader_no);
return TRUE;
return G_SOURCE_CONTINUE;
}
static gboolean
idle_cb (void *data)
idle_cb (gpointer data)
{
clutter_actor_queue_redraw (data);
return TRUE;
return G_SOURCE_CONTINUE;
}
static gboolean
......@@ -394,11 +394,11 @@ test_cogl_shader_arbfp_main (int argc, char *argv[])
g_signal_connect (stage, "delete-event",
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 ();
......
......@@ -180,10 +180,10 @@ static int shader_no = 0;
static void
paint_cb (ClutterActor *actor)
{
int stage_width = clutter_actor_get_width (actor);
int stage_height = clutter_actor_get_height (actor);
int image_width = cogl_texture_get_width (redhand);
int image_height = cogl_texture_get_height (redhand);
float stage_width = clutter_actor_get_width (actor);
float stage_height = clutter_actor_get_height (actor);
float image_width = cogl_texture_get_width (redhand);
float image_height = cogl_texture_get_height (redhand);
cogl_set_source (material);
cogl_rectangle (stage_width/2.0f - image_width/2.0f,
......@@ -237,7 +237,7 @@ set_shader_num (int new_no)
static gboolean
button_release_cb (ClutterActor *actor,
ClutterEvent *event,
void *data)
gpointer data)
{
int new_no;
......@@ -264,13 +264,13 @@ button_release_cb (ClutterActor *actor,
set_shader_num (new_no);
return FALSE;
return CLUTTER_EVENT_STOP;
}
static gboolean
key_release_cb (ClutterActor *actor,
ClutterEvent *event,
void *user_data)
gpointer user_data)
{
guint keysym = clutter_event_get_key_symbol (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))
clutter_main_quit ();
return FALSE;
return CLUTTER_EVENT_STOP;
}
static gboolean
timeout_cb (void *user_data)
timeout_cb (gpointer user_data)
{
shader_no++;
if (shader_no > (G_N_ELEMENTS (shaders) - 1))
......@@ -291,24 +291,25 @@ timeout_cb (void *user_data)
set_shader_num (shader_no);
return TRUE;
return G_SOURCE_CONTINUE;
}
static gboolean
idle_cb (void *data)
idle_cb (gpointer data)
{
clutter_actor_queue_redraw (data);
return TRUE;
return G_SOURCE_CONTINUE;
}
static gboolean
destroy_window_cb (ClutterStage *stage,
ClutterEvent *event,
void *user_data)
gpointer user_data)
{
clutter_main_quit ();
return TRUE;
return CLUTTER_EVENT_STOP;
}
G_MODULE_EXPORT int
......@@ -351,11 +352,11 @@ test_cogl_shader_glsl_main (int argc, char *argv[])
g_signal_connect (stage, "delete-event",
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 ();
......
......@@ -16,14 +16,14 @@ static ClutterActor *raise_actor[2];
static gboolean raise_no = 0;
static gboolean
raise_top (gpointer ignored)
raise_top (gpointer ignored G_GNUC_UNUSED)
{
ClutterActor *parent = clutter_actor_get_parent (raise_actor[raise_no]);
clutter_actor_set_child_above_sibling (parent, raise_actor[raise_no], NULL);
raise_no = !raise_no;
return TRUE;
return G_SOURCE_CONTINUE;
}
static ClutterActor *
......@@ -106,7 +106,6 @@ janus_group (const gchar *front_text,
return group;
}
G_MODULE_EXPORT gint
test_depth_main (int argc, char *argv[])
{
......@@ -118,7 +117,7 @@ test_depth_main (int argc, char *argv[])
GError *error;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
return EXIT_FAILURE;
stage = clutter_stage_new ();
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_actor (CLUTTER_CONTAINER (stage), label);
/* 3 seconds, at 60 fps */
timeline = clutter_timeline_new (3000);
g_signal_connect (timeline,
"completed", G_CALLBACK (timeline_completed),
......@@ -200,7 +198,7 @@ test_depth_main (int argc, char *argv[])
raise_actor[0] = rect;
raise_actor[1] = hand;
g_timeout_add (2000, raise_top, NULL);
clutter_threads_add_timeout (2000, raise_top, NULL);
clutter_main ();
......
......@@ -89,9 +89,11 @@ stage_key_release_cb (ClutterActor *actor,
}
static gboolean
draw_arc (Pixmap pixmap)
draw_arc (data)
{
Pixmap pixmap = GPOINTER_TO_UINT (data);
Display *dpy = clutter_x11_get_default_display ();
static GC gc = None;
static int x = 100, y = 100;
......@@ -116,7 +118,7 @@ draw_arc (Pixmap pixmap)
x -= 5;
y -= 5;
return TRUE;
return G_SOURCE_CONTINUE;
}
static gboolean
......@@ -124,9 +126,9 @@ stage_button_press_cb (ClutterActor *actor,
ClutterEvent *event,
gpointer data)
{
draw_arc ((Pixmap)data);
draw_arc (GPOINTER_TO_UINT (data));
return FALSE;
return CLUTTER_EVENT_STOP;
}
Pixmap
......@@ -311,7 +313,7 @@ test_pixmap_main (int argc, char **argv)
if (!disable_animation)
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 ();
......
......@@ -277,7 +277,7 @@ button_release_cb (ClutterActor *actor,
set_shader_num (actor, new_no);
return FALSE;
return CLUTTER_EVENT_STOP;
}
#ifdef COGL_HAS_GLES2
......@@ -291,7 +291,7 @@ timeout_cb (gpointer data)
set_shader_num (CLUTTER_ACTOR (data), new_no);
return TRUE;
return G_SOURCE_CONTINUE;
}
#endif /* COGL_HAS_GLES2 */
......@@ -399,7 +399,7 @@ test_shader_main (gint argc, gchar *argv[])
#ifdef COGL_HAS_GLES2
/* On an embedded platform it is difficult to right click so we will
cycle through the shaders automatically */
g_timeout_add_seconds (3, timeout_cb, actor);
clutter_threads_add_timeout (3000, timeout_cb, actor);
#endif
/* Show everying ( and map window ) */
......
......@@ -40,7 +40,7 @@ queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
return G_SOURCE_CONTINUE;
}
static gunichar
......@@ -179,7 +179,7 @@ main (int argc, char *argv[])
clutter_actor_show_all (stage);
g_idle_add (queue_redraw, stage);
clutter_threads_add_idle (queue_redraw, stage);
clutter_main ();
......
......@@ -36,7 +36,7 @@ queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
return G_SOURCE_CONTINUE;
}
int
......@@ -60,7 +60,7 @@ main (int argc, char *argv[])
clutter_actor_set_size (group, STAGE_WIDTH, STAGE_WIDTH);
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);
......
......@@ -34,7 +34,7 @@ void clutter_perf_fps_start (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)
......@@ -126,5 +126,5 @@ static gboolean perf_fake_mouse_cb (gpointer stage)
yd = CLAMP(yd, -1.3, 1.3);
}
clutter_event_free (event);
return TRUE;
return G_SOURCE_CONTINUE;
}
......@@ -15,7 +15,8 @@ static gboolean
queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
return G_SOURCE_CONTINUE;
}
static gunichar
......@@ -158,7 +159,7 @@ main (int argc, char *argv[])
clutter_actor_show_all (stage);
clutter_perf_fps_start (CLUTTER_STAGE (stage));
g_idle_add (queue_redraw, stage);
clutter_threads_add_idle (queue_redraw, stage);
clutter_main ();
clutter_perf_fps_report ("test-text-perf");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment