mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
tests: Use ClutterStage "after-paint" instead of ClutterActor "paint"
The "paint" signal of ClutterActor is deprecated and will be removed. We have a good replacement to get notified about stage paints nowadays, that is "after-paint" on ClutterStage, so switch to that signal where it makes sense. I didn't bother to update the few tests (namely Clutters conform/texture-fbo.c, conform/text-cache.c, interactive/test-cogl-multitexture.c and Cogls conform/test-multitexture.c, conform/test-texture-mipmaps.c) where it's harder to replace the signal since we don't build those anyway. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1522
This commit is contained in:
parent
a03e233b44
commit
4e63ed524e
@ -15,9 +15,9 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
|
||||
|
||||
|
||||
static void
|
||||
on_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
void *state)
|
||||
on_after_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
void *state)
|
||||
{
|
||||
float saved_viewport[4];
|
||||
graphene_matrix_t saved_projection;
|
||||
@ -162,7 +162,7 @@ test_readpixels (TestUtilsGTestFixture *fixture,
|
||||
* the first few frames, and we won't be doing anything else that
|
||||
* will trigger redrawing. */
|
||||
idle_source = g_idle_add (queue_redraw, stage);
|
||||
g_signal_connect_after (stage, "paint", G_CALLBACK (on_paint), NULL);
|
||||
g_signal_connect (CLUTTER_STAGE (stage), "after-paint", G_CALLBACK (on_after_paint), NULL);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
clutter_test_main ();
|
||||
|
@ -140,9 +140,9 @@ check_paint (TestState *state, int x, int y, int scale)
|
||||
#define FRAME_COUNT_UPDATED 8
|
||||
|
||||
static void
|
||||
on_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
TestState *state)
|
||||
on_after_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
TestState *state)
|
||||
{
|
||||
CoglHandle material;
|
||||
|
||||
@ -219,8 +219,8 @@ test_texture_pixmap_x11 (TestUtilsGTestFixture *fixture,
|
||||
|
||||
clutter_actor_set_background_color (CLUTTER_ACTOR (state.stage), &stage_color);
|
||||
|
||||
paint_handler = g_signal_connect_after (state.stage, "paint",
|
||||
G_CALLBACK (on_paint), &state);
|
||||
paint_handler = g_signal_connect (CLUTTER_STAGE (state.stage), "after-paint",
|
||||
G_CALLBACK (on_after_paint), &state);
|
||||
|
||||
idle_handler = g_idle_add (queue_redraw, state.stage);
|
||||
|
||||
|
@ -66,9 +66,9 @@ assert_rectangle_color_and_black_border (int x,
|
||||
|
||||
|
||||
static void
|
||||
on_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
void *state)
|
||||
on_after_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
void *state)
|
||||
{
|
||||
float saved_viewport[4];
|
||||
graphene_matrix_t saved_projection;
|
||||
@ -400,7 +400,7 @@ test_viewport (TestUtilsGTestFixture *fixture,
|
||||
* the first few frames, and we won't be doing anything else that
|
||||
* will trigger redrawing. */
|
||||
idle_source = g_idle_add (queue_redraw, stage);
|
||||
g_signal_connect_after (stage, "paint", G_CALLBACK (on_paint), NULL);
|
||||
g_signal_connect (CLUTTER_STAGE (stage), "after-paint", G_CALLBACK (on_after_paint), NULL);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
clutter_test_main ();
|
||||
|
@ -168,12 +168,12 @@ verify_redraw (Data *data, int expected_paint_count)
|
||||
GMainLoop *main_loop = g_main_loop_new (NULL, TRUE);
|
||||
gulong paint_handler;
|
||||
|
||||
paint_handler = g_signal_connect_data (data->stage,
|
||||
"paint",
|
||||
paint_handler = g_signal_connect_data (CLUTTER_STAGE (data->stage),
|
||||
"after-paint",
|
||||
G_CALLBACK (g_main_loop_quit),
|
||||
main_loop,
|
||||
NULL,
|
||||
G_CONNECT_SWAPPED | G_CONNECT_AFTER);
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
/* Queue a redraw on the stage */
|
||||
clutter_actor_queue_redraw (data->stage);
|
||||
|
@ -97,9 +97,9 @@ generate_round_texture (void)
|
||||
}
|
||||
|
||||
static void
|
||||
paint_cb (ClutterActor *stage,
|
||||
ClutterPaintContext *paint_context,
|
||||
Data *data)
|
||||
on_after_paint (ClutterActor *stage,
|
||||
ClutterPaintContext *paint_context,
|
||||
Data *data)
|
||||
{
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
@ -258,7 +258,7 @@ test_cogl_point_sprites_main (int argc, char *argv[])
|
||||
clutter_actor_set_background_color (CLUTTER_ACTOR (stage), CLUTTER_COLOR_Black);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Point Sprites");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_test_quit), NULL);
|
||||
g_signal_connect_after (stage, "paint", G_CALLBACK (paint_cb), &data);
|
||||
g_signal_connect (CLUTTER_STAGE (stage), "after-paint", G_CALLBACK (on_after_paint), &data);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
|
@ -166,8 +166,8 @@ static unsigned int timeout_id = 0;
|
||||
static int shader_no = 0;
|
||||
|
||||
static void
|
||||
paint_cb (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
on_after_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
@ -326,7 +326,7 @@ test_cogl_shader_glsl_main (int argc, char *argv[])
|
||||
cogl_material_set_layer (material, 0, redhand);
|
||||
|
||||
set_shader_num (0);
|
||||
g_signal_connect_after (stage, "paint", G_CALLBACK (paint_cb), NULL);
|
||||
g_signal_connect (CLUTTER_STAGE (stage), "after-paint", G_CALLBACK (on_after_paint), NULL);
|
||||
|
||||
clutter_actor_set_reactive (stage, TRUE);
|
||||
g_signal_connect (stage, "button-release-event",
|
||||
|
@ -112,9 +112,9 @@ TestCallback tests[] =
|
||||
};
|
||||
|
||||
static void
|
||||
on_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
TestState *state)
|
||||
on_after_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
TestState *state)
|
||||
{
|
||||
tests[state->current_test] (state, paint_context);
|
||||
}
|
||||
@ -152,7 +152,7 @@ main (int argc, char *argv[])
|
||||
/* We want continuous redrawing of the stage... */
|
||||
clutter_threads_add_idle (queue_redraw, stage);
|
||||
|
||||
g_signal_connect_after (stage, "paint", G_CALLBACK (on_paint), &state);
|
||||
g_signal_connect (CLUTTER_STAGE (stage), "after-paint", G_CALLBACK (on_after_paint), &state);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
|
@ -56,9 +56,9 @@ do_events (ClutterActor *stage)
|
||||
}
|
||||
|
||||
static void
|
||||
on_paint (ClutterActor *stage,
|
||||
ClutterPaintContext *paint_context,
|
||||
gconstpointer *data)
|
||||
on_after_paint (ClutterActor *stage,
|
||||
ClutterPaintContext *paint_context,
|
||||
gconstpointer *data)
|
||||
{
|
||||
do_events (stage);
|
||||
}
|
||||
@ -129,7 +129,7 @@ main (int argc, char **argv)
|
||||
|
||||
clutter_threads_add_idle (queue_redraw, stage);
|
||||
|
||||
g_signal_connect (stage, "paint", G_CALLBACK (on_paint), NULL);
|
||||
g_signal_connect (CLUTTER_STAGE (stage), "after-paint", G_CALLBACK (on_after_paint), NULL);
|
||||
|
||||
clutter_test_main ();
|
||||
|
||||
|
@ -13,9 +13,9 @@ static int n_chars;
|
||||
static int rows, cols;
|
||||
|
||||
static void
|
||||
on_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
gconstpointer *data)
|
||||
on_after_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
gconstpointer *data)
|
||||
{
|
||||
static GTimer *timer = NULL;
|
||||
static int fps = 0;
|
||||
@ -135,7 +135,7 @@ main (int argc, char *argv[])
|
||||
clutter_actor_set_background_color (CLUTTER_ACTOR (stage), CLUTTER_COLOR_Black);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Text Performance");
|
||||
|
||||
g_signal_connect (stage, "paint", G_CALLBACK (on_paint), NULL);
|
||||
g_signal_connect (CLUTTER_STAGE (stage), "after-paint", G_CALLBACK (on_after_paint), NULL);
|
||||
|
||||
label = create_label ();
|
||||
w = clutter_actor_get_width (label);
|
||||
|
@ -12,9 +12,9 @@
|
||||
#define ROWS 20
|
||||
|
||||
static void
|
||||
on_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
gconstpointer *data)
|
||||
on_after_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
gconstpointer *data)
|
||||
{
|
||||
static GTimer *timer = NULL;
|
||||
static int fps = 0;
|
||||
@ -65,7 +65,7 @@ main (int argc, char *argv[])
|
||||
|
||||
clutter_threads_add_idle (queue_redraw, stage);
|
||||
|
||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), NULL);
|
||||
g_signal_connect (CLUTTER_STAGE (stage), "after-paint", G_CALLBACK (on_after_paint), NULL);
|
||||
|
||||
{
|
||||
gint row, col;
|
||||
|
@ -28,15 +28,15 @@ clutter_perf_fps_init (void)
|
||||
g_random_set_seed (12345678);
|
||||
}
|
||||
|
||||
static void perf_stage_paint_cb (ClutterStage *stage,
|
||||
ClutterPaintContext *paint_context,
|
||||
gpointer *data);
|
||||
static void perf_stage_after_paint_cb (ClutterStage *stage,
|
||||
ClutterPaintContext *paint_context,
|
||||
gpointer *data);
|
||||
static gboolean perf_fake_mouse_cb (gpointer stage);
|
||||
|
||||
static inline void
|
||||
clutter_perf_fps_start (ClutterStage *stage)
|
||||
{
|
||||
g_signal_connect (stage, "paint", G_CALLBACK (perf_stage_paint_cb), NULL);
|
||||
g_signal_connect (stage, "after-paint", G_CALLBACK (perf_stage_after_paint_cb), NULL);
|
||||
}
|
||||
|
||||
static inline void
|
||||
@ -53,9 +53,9 @@ clutter_perf_fps_report (const gchar *id)
|
||||
}
|
||||
|
||||
static void
|
||||
perf_stage_paint_cb (ClutterStage *stage,
|
||||
ClutterPaintContext *paint_context,
|
||||
gpointer *data)
|
||||
perf_stage_after_paint_cb (ClutterStage *stage,
|
||||
ClutterPaintContext *paint_context,
|
||||
gpointer *data)
|
||||
{
|
||||
if (!testtimer)
|
||||
testtimer = g_timer_new ();
|
||||
|
Loading…
Reference in New Issue
Block a user