clutter/timeline: Deprecate timelines without an actor or frame clock

Without an associated actor, or explicit frame clock set, in the future
a timeline will not know how to progress, as there will be no singe
frame clock to assume is the main one. Thus, deprecate the construction
of timelines without either an actor or frame clock set.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
This commit is contained in:
Jonas Ådahl
2020-04-17 09:03:44 +02:00
parent 203c20d7ad
commit 2b95ec40c6
22 changed files with 103 additions and 42 deletions

View File

@ -1,12 +1,16 @@
{
"id" : "timeline0",
"type" : "ClutterTimeline",
"duration" : 1000,
[
{ "id" : "actor0", "type" : "ClutterActor" },
{
"id" : "timeline0",
"type" : "ClutterTimeline",
"duration" : 1000,
"actor" : "actor0",
"markers" : [
{ "name" : "marker0", "time" : 250 },
{ "name" : "marker1", "time" : 500 },
{ "name" : "marker2", "time" : 750 },
{ "name" : "marker3", "progress" : 0.5 }
]
}
"markers" : [
{ "name" : "marker0", "time" : 250 },
{ "name" : "marker1", "time" : 500 },
{ "name" : "marker2", "time" : 750 },
{ "name" : "marker3", "progress" : 0.5 }
]
}
]

View File

@ -139,7 +139,7 @@ timeline_interpolation (void)
stage = clutter_test_get_stage ();
state.timeline =
clutter_timeline_new (TEST_TIMELINE_DURATION);
clutter_timeline_new_for_actor (stage, TEST_TIMELINE_DURATION);
clutter_timeline_set_repeat_count (state.timeline, -1);
g_signal_connect (G_OBJECT(state.timeline),
"new-frame",

View File

@ -7,9 +7,10 @@
static void
timeline_progress_step (void)
{
ClutterActor *stage = clutter_test_get_stage ();
ClutterTimeline *timeline;
timeline = clutter_timeline_new (1000);
timeline = clutter_timeline_new_for_actor (stage, 1000);
if (!g_test_quiet ())
g_print ("mode: step(3, end)\n");
@ -90,9 +91,10 @@ timeline_progress_step (void)
static void
timeline_progress_mode (void)
{
ClutterActor *stage = clutter_test_get_stage ();
ClutterTimeline *timeline;
timeline = clutter_timeline_new (1000);
timeline = clutter_timeline_new_for_actor (stage, 1000);
g_assert (clutter_timeline_get_progress_mode (timeline) == CLUTTER_LINEAR);
g_assert_cmpfloat (clutter_timeline_get_progress (timeline), ==, 0.0);

View File

@ -76,7 +76,7 @@ timeline_rewind (void)
stage = clutter_test_get_stage ();
state.timeline =
clutter_timeline_new (TEST_TIMELINE_DURATION);
clutter_timeline_new_for_actor (stage, TEST_TIMELINE_DURATION);
g_signal_connect (G_OBJECT(state.timeline),
"new-frame",
G_CALLBACK(new_frame_cb),

View File

@ -198,7 +198,7 @@ timeline_base (void)
stage = clutter_test_get_stage ();
timeline_data_init (&data_1, 1);
timeline_1 = clutter_timeline_new (FRAME_COUNT * 1000 / FPS);
timeline_1 = clutter_timeline_new_for_actor (stage, FRAME_COUNT * 1000 / FPS);
clutter_timeline_add_marker_at_time (timeline_1, "start-marker",
0 * 1000 / FPS);
clutter_timeline_add_marker_at_time (timeline_1, "foo", 5 * 1000 / FPS);
@ -215,7 +215,7 @@ timeline_base (void)
g_strfreev (markers);
timeline_data_init (&data_2, 2);
timeline_2 = clutter_timeline_new (FRAME_COUNT * 1000 / FPS);
timeline_2 = clutter_timeline_new_for_actor (stage, FRAME_COUNT * 1000 / FPS);
clutter_timeline_add_marker_at_time (timeline_2, "bar", 2 * 1000 / FPS);
markers = clutter_timeline_list_markers (timeline_2, -1, &n_markers);
g_assert (markers != NULL);
@ -224,7 +224,7 @@ timeline_base (void)
g_strfreev (markers);
timeline_data_init (&data_3, 3);
timeline_3 = clutter_timeline_new (FRAME_COUNT * 1000 / FPS);
timeline_3 = clutter_timeline_new_for_actor (stage, FRAME_COUNT * 1000 / FPS);
clutter_timeline_set_direction (timeline_3, CLUTTER_TIMELINE_BACKWARD);
clutter_timeline_add_marker_at_time (timeline_3, "start-marker",
FRAME_COUNT * 1000 / FPS);

View File

@ -184,7 +184,7 @@ test_actors_main (int argc, char *argv[])
clutter_stage_set_title (CLUTTER_STAGE (oh->stage), "Actors");
/* Create a timeline to manage animation */
oh->timeline = clutter_timeline_new (6000);
oh->timeline = clutter_timeline_new_for_actor (oh->stage, 6000);
clutter_timeline_set_repeat_count (oh->timeline, -1);
/* fire a callback for frame change */

View File

@ -209,12 +209,12 @@ test_cairo_flowers_main (int argc, char **argv)
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
/* Create a timeline to manage animation */
timeline = clutter_timeline_new (6000);
clutter_timeline_set_repeat_count (timeline, -1);
stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cairo Flowers");
/* Create a timeline to manage animation */
timeline = clutter_timeline_new_for_actor (stage, 6000);
clutter_timeline_set_repeat_count (timeline, -1);
g_signal_connect (stage, "destroy", G_CALLBACK (stop_and_quit), timeline);
clutter_actor_set_background_color (stage, CLUTTER_COLOR_Black);

View File

@ -212,7 +212,7 @@ test_cogl_multitexture_main (int argc, char *argv[])
clutter_container_add_actor (CLUTTER_CONTAINER(stage),
state->group);
state->timeline = clutter_timeline_new (2812);
state->timeline = clutter_timeline_new_for_actor (stage, 2812);
g_signal_connect (state->timeline, "new-frame", G_CALLBACK (frame_cb), state);

View File

@ -409,7 +409,7 @@ test_cogl_tex_polygon_main (int argc, char *argv[])
clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
/* Timeline for animation */
timeline = clutter_timeline_new (6000);
timeline = clutter_timeline_new_for_actor (stage, 6000);
clutter_timeline_set_repeat_count (timeline, -1);
g_signal_connect (timeline, "new-frame", G_CALLBACK (frame_cb), coglbox);
clutter_timeline_start (timeline);

View File

@ -215,7 +215,7 @@ test_cogl_tex_tile_main (int argc, char *argv[])
clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
/* Timeline for animation */
timeline = clutter_timeline_new (6000); /* 6 second duration */
timeline = clutter_timeline_new_for_actor (stage, 6000); /* 6 second duration */
clutter_timeline_set_repeat_count (timeline, -1);
g_signal_connect (timeline, "new-frame", G_CALLBACK (frame_cb), coglbox);
clutter_timeline_start (timeline);

View File

@ -607,7 +607,7 @@ test_layout_main (int argc, char *argv[])
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);
main_timeline = clutter_timeline_new_for_actor (stage, 2000);
clutter_timeline_set_repeat_count (main_timeline, -1);
clutter_timeline_set_auto_reverse (main_timeline, TRUE);
g_signal_connect (main_timeline, "new-frame",

View File

@ -241,7 +241,7 @@ test_paint_wrapper_main (int argc, char *argv[])
oh->stage = stage;
/* Create a timeline to manage animation */
oh->timeline = clutter_timeline_new (6000);
oh->timeline = clutter_timeline_new_for_actor (oh->stage, 6000);
clutter_timeline_set_repeat_count (oh->timeline, -1);
/* fire a callback for frame change */

View File

@ -21,15 +21,15 @@ test_shader_effects_main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
/* Make a timeline */
timeline = clutter_timeline_new (7692);
clutter_timeline_set_repeat_count (timeline, -1);
stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Rotations");
clutter_actor_set_background_color (stage, CLUTTER_COLOR_Aluminium3);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Make a timeline */
timeline = clutter_timeline_new_for_actor (stage, 7692);
clutter_timeline_set_repeat_count (timeline, -1);
/* Make a hand */
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
hand = clutter_test_utils_create_texture_from_file (file, NULL);