]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
ply-progress-bar: Allow caller to specify the widgets width and height
authorHans de Goede <hdegoede@redhat.com>
Fri, 8 Feb 2019 13:38:44 +0000 (14:38 +0100)
committerHans de Goede <hdegoede@redhat.com>
Sat, 23 Feb 2019 13:56:54 +0000 (14:56 +0100)
Before this commit ply_progress_bar_show would take coordinates for where
to show the progress-bar but the width and height were hardcodec. This
commit adds width and height parametes, so that the caller can specify
the width and height too.

This commit does not change behavior for existing users (tested with the
spinfinity theme).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
src/libply-splash-graphics/ply-progress-bar.c
src/libply-splash-graphics/ply-progress-bar.h
src/plugins/splash/throbgress/plugin.c

index e5697b4660d03add058f9759b4553a02ee2a9655..369255af2f4fca72b12aa24ca8c2b9f3014e870e 100644 (file)
 #include "ply-image.h"
 #include "ply-utils.h"
 
-#ifndef BAR_HEIGHT
-#define BAR_HEIGHT 16
-#endif
-
 struct _ply_progress_bar
 {
         ply_pixel_display_t *display;
@@ -134,15 +130,17 @@ void
 ply_progress_bar_show (ply_progress_bar_t  *progress_bar,
                        ply_pixel_display_t *display,
                        long                 x,
-                       long                 y)
+                       long                 y,
+                       unsigned long        width,
+                       unsigned long        height)
 {
         assert (progress_bar != NULL);
 
         progress_bar->display = display;
         progress_bar->area.x = x;
         progress_bar->area.y = y;
-        progress_bar->area.height = BAR_HEIGHT;
-        progress_bar->area.width = ply_pixel_display_get_width (display);
+        progress_bar->area.height = height;
+        progress_bar->area.width = width;
 
         progress_bar->is_hidden = false;
         ply_progress_bar_draw (progress_bar);
index 1eab64c5e197d9d0ec7e45a058564494606b083a..55f5a4809701fe028e8f18f62dc9c126b6e6121d 100644 (file)
@@ -40,7 +40,9 @@ void ply_progress_bar_free (ply_progress_bar_t *bar);
 void ply_progress_bar_show (ply_progress_bar_t  *bar,
                             ply_pixel_display_t *display,
                             long                 x,
-                            long                 y);
+                            long                 y,
+                            unsigned long        width,
+                            unsigned long        height);
 void ply_progress_bar_hide (ply_progress_bar_t *bar);
 void ply_progress_bar_draw (ply_progress_bar_t *bar);
 void ply_progress_bar_draw_area (ply_progress_bar_t *bar,
index 4016d9661a4e7cc0a7254feaaa311eed29b08f89..bbcf1b7cd2a30b8b0c982ff47342fd4de41100c6 100644 (file)
@@ -316,7 +316,10 @@ view_start_animation (view_t *view)
                             view->logo_area.y + view->logo_area.height + height / 2);
         ply_progress_bar_show (view->progress_bar,
                                view->display,
-                               0, screen_height - ply_progress_bar_get_height (view->progress_bar));
+                               0,
+                               screen_height - BAR_HEIGHT,
+                               screen_width,
+                               BAR_HEIGHT);
         view_redraw (view);
 }