]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
two-step: Add new UseAnimation setting
authorHans de Goede <hdegoede@redhat.com>
Wed, 25 Sep 2019 16:56:34 +0000 (18:56 +0200)
committerHans de Goede <hdegoede@redhat.com>
Fri, 27 Sep 2019 07:36:51 +0000 (09:36 +0200)
Until now we have been disabling the animations when the theme specifies
that a progress-bar should be drawn for the current mode.

This commit adds a new UseAnimation setting which defaults to
!UseProgressBar to preserve the old behavior if UseAnimation is not
set by the theme.

This makes two-step more flexible. Specifically it will allow implementing
the spinfinity theme using two-step; and spinifinity is the only user of
the throbgress plugin, so this will allow removal of that plugin.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
src/plugins/splash/two-step/plugin.c

index ce888347686fbc3fa47a9b0f96937c7ac0a9ed58..6d8ae72b9ca4c1574ba49d09473c4da740011669 100644 (file)
@@ -118,6 +118,7 @@ typedef struct
         bool                      suppress_messages;
         bool                      progress_bar_show_percent_complete;
         bool                      use_progress_bar;
+        bool                      use_animation;
         bool                      use_firmware_background;
         char                     *title;
         char                     *subtitle;
@@ -833,7 +834,10 @@ view_start_progress_animation (view_t *view)
                                        x, y, width, height);
                 ply_pixel_display_draw_area (view->display, x, y, width, height);
                 view->animation_bottom = y + height;
-        } else if (view->throbber != NULL) {
+        }
+
+        if (plugin->mode_settings[plugin->mode].use_animation &&
+            view->throbber != NULL) {
                 width = ply_throbber_get_width (view->throbber);
                 height = ply_throbber_get_height (view->throbber);
                 x = plugin->animation_horizontal_alignment * screen_width - width / 2.0;
@@ -852,7 +856,8 @@ view_start_progress_animation (view_t *view)
             plugin->mode == PLY_BOOT_SPLASH_MODE_REBOOT)
                 return;
 
-        if (view->progress_animation != NULL) {
+        if (plugin->mode_settings[plugin->mode].use_animation &&
+            view->progress_animation != NULL) {
                 width = ply_progress_animation_get_width (view->progress_animation);
                 height = ply_progress_animation_get_height (view->progress_animation);
                 x = plugin->animation_horizontal_alignment * screen_width - width / 2.0;
@@ -966,6 +971,13 @@ load_mode_settings (ply_boot_splash_plugin_t *plugin,
         settings->use_firmware_background =
                 ply_key_file_get_bool (key_file, group_name, "UseFirmwareBackground");
 
+        /* This defaults to !use_progress_bar for compat. with older themes */
+        if (ply_key_file_has_key (key_file, group_name, "UseAnimation"))
+                settings->use_animation =
+                        ply_key_file_get_bool (key_file, group_name, "UseAnimation");
+        else
+                settings->use_animation = !settings->use_progress_bar;
+
         /* If any mode uses the firmware background, then we need to load it */
         if (settings->use_firmware_background)
                 plugin->use_firmware_background = true;
@@ -1235,8 +1247,7 @@ static void
 start_end_animation (ply_boot_splash_plugin_t *plugin,
                      ply_trigger_t            *trigger)
 {
-        if (plugin->mode_settings[plugin->mode].use_progress_bar) {
-                /* Leave the progress-bar at 100% rather then showing the end animation */
+        if (!plugin->mode_settings[plugin->mode].use_animation) {
                 ply_trigger_pull (trigger, NULL);
                 return;
         }
@@ -1458,19 +1469,26 @@ on_draw (view_t             *view,
                 if (plugin->mode_settings[plugin->mode].use_progress_bar)
                         ply_progress_bar_draw_area (view->progress_bar, pixel_buffer,
                                                     x, y, width, height);
-                else if (view->throbber != NULL &&
+
+                if (plugin->mode_settings[plugin->mode].use_animation &&
+                    view->throbber != NULL &&
                     !ply_throbber_is_stopped (view->throbber))
                         ply_throbber_draw_area (view->throbber, pixel_buffer,
                                                 x, y, width, height);
-                if (view->progress_animation != NULL && !ply_progress_animation_is_hidden (view->progress_animation)) {
+
+                if (plugin->mode_settings[plugin->mode].use_animation &&
+                    view->progress_animation != NULL &&
+                    !ply_progress_animation_is_hidden (view->progress_animation))
                         ply_progress_animation_draw_area (view->progress_animation,
                                                           pixel_buffer,
                                                           x, y, width, height);
-                } else if (!ply_animation_is_stopped (view->end_animation)) {
+
+                if (plugin->mode_settings[plugin->mode].use_animation &&
+                    view->end_animation != NULL &&
+                    !ply_animation_is_stopped (view->end_animation))
                         ply_animation_draw_area (view->end_animation,
                                                  pixel_buffer,
                                                  x, y, width, height);
-                }
 
                 if (plugin->corner_image != NULL) {
                         image_area.width = ply_image_get_width (plugin->corner_image);