From 4d3f553efcc3cae1399d1c5715259174e9147ab1 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 26 Feb 2015 17:14:57 -0800 Subject: two-step: Make SHOW_ANIMATION_FRACTION configurable Allow themes to configure at which percentage of the boot progress the animation should transition to the end animation. At Endless we use this to only show the end animation from the start of the boot splash by setting it to 0.0. --- src/plugins/splash/two-step/plugin.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c index 9c8bc439..8aab3b99 100644 --- a/src/plugins/splash/two-step/plugin.c +++ b/src/plugins/splash/two-step/plugin.c @@ -174,6 +174,7 @@ struct _ply_boot_splash_plugin uint32_t progress_bar_bg_color; uint32_t progress_bar_fg_color; + double show_animation_fraction; progress_function_t progress_function; ply_trigger_t *idle_trigger; @@ -1048,6 +1049,7 @@ create_plugin (ply_key_file_t *key_file) char *image_dir, *image_path; char *transition; char *progress_function; + char *show_animation_fraction; srand ((int) ply_get_timestamp ()); plugin = calloc (1, sizeof(ply_boot_splash_plugin_t)); @@ -1209,6 +1211,13 @@ create_plugin (ply_key_file_t *key_file) free (progress_function); } + show_animation_fraction = ply_key_file_get_value (key_file, "two-step", "ShowAnimationPercent"); + if (show_animation_fraction != NULL) + plugin->show_animation_fraction = strtod (show_animation_fraction, NULL); + else + plugin->show_animation_fraction = SHOW_ANIMATION_FRACTION; + free (show_animation_fraction); + plugin->views = ply_list_new (); return plugin; @@ -1795,7 +1804,7 @@ on_boot_progress (ply_boot_splash_plugin_t *plugin, * become_idle gets called. */ if (plugin->mode_settings[plugin->mode].use_end_animation && - fraction_done >= SHOW_ANIMATION_FRACTION) { + fraction_done >= plugin->show_animation_fraction) { if (plugin->stop_trigger == NULL) { ply_trace ("boot progressed to end"); @@ -1809,7 +1818,7 @@ on_boot_progress (ply_boot_splash_plugin_t *plugin, } else { double total_duration; - fraction_done *= (1 / SHOW_ANIMATION_FRACTION); + fraction_done *= (1 / plugin->show_animation_fraction); switch (plugin->progress_function) { /* Fun made-up smoothing function to make the growth asymptotic: -- cgit v1.2.3