clutter_main_quit ();
- return FALSE;
+ return G_SOURCE_REMOVE;
}
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);
break;
}
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
void
/* 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);
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
static CoglHandle
/* 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);
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
void
/* 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);
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
void
/* 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);
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
void
/* 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);
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
void
/* 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);
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
static CoglHandle
/* 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);
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
void
/* 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);
clutter_main_quit ();
- return FALSE;
+ return G_SOURCE_REMOVE;
}
void
/* 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 ();
}
static gboolean
-on_timeout (State *state)
+on_timeout (gpointer data)
{
+ State *state = data;
int test_num = 0;
int y, x;
ClutterActor *over_actor = NULL;
clutter_main_quit ();
- return FALSE;
+ return G_SOURCE_REMOVE;
}
void
clutter_actor_show (state.stage);
- g_idle_add ((GSourceFunc) on_timeout, &state);
+ clutter_threads_add_idle (on_timeout, &state);
clutter_main ();
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
void
/* 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);
} 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)
clutter_main_quit ();
}
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static 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>
{
clutter_actor_queue_redraw (data);
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
G_MODULE_EXPORT int
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 ();
clutter_actor_show (stage);
- g_idle_add (idle_cb, stage);
+ clutter_threads_add_idle (idle_cb, stage);
clutter_main ();
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);
((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))
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
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 ();
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,
static gboolean
button_release_cb (ClutterActor *actor,
ClutterEvent *event,
- void *data)
+ gpointer data)
{
int new_no;
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);
((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))
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
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 ();
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 *
return group;
}
-
G_MODULE_EXPORT gint
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");
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),
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 ();
}
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;
x -= 5;
y -= 5;
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
static gboolean
ClutterEvent *event,
gpointer data)
{
- draw_arc ((Pixmap)data);
+ draw_arc (GPOINTER_TO_UINT (data));
- return FALSE;
+ return CLUTTER_EVENT_STOP;
}
Pixmap
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 ();
set_shader_num (actor, new_no);
- return FALSE;
+ return CLUTTER_EVENT_STOP;
}
#ifdef COGL_HAS_GLES2
set_shader_num (CLUTTER_ACTOR (data), new_no);
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
#endif /* COGL_HAS_GLES2 */
#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 ) */
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
static gunichar
clutter_actor_show_all (stage);
- g_idle_add (queue_redraw, stage);
+ clutter_threads_add_idle (queue_redraw, stage);
clutter_main ();
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
int
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);
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)
yd = CLAMP(yd, -1.3, 1.3);
}
clutter_event_free (event);
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
- return TRUE;
+
+ return G_SOURCE_CONTINUE;
}
static gunichar
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");