From: Hans de Goede Date: Fri, 8 Feb 2019 13:38:44 +0000 (+0100) Subject: ply-progress-bar: Allow caller to specify the widgets width and height X-Git-Tag: 0.9.5~74^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e33c1f3a06f47e78bb479a50b27f5b2ab39476eb;p=thirdparty%2Fplymouth.git ply-progress-bar: Allow caller to specify the widgets width and height 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 --- diff --git a/src/libply-splash-graphics/ply-progress-bar.c b/src/libply-splash-graphics/ply-progress-bar.c index e5697b46..369255af 100644 --- a/src/libply-splash-graphics/ply-progress-bar.c +++ b/src/libply-splash-graphics/ply-progress-bar.c @@ -51,10 +51,6 @@ #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); diff --git a/src/libply-splash-graphics/ply-progress-bar.h b/src/libply-splash-graphics/ply-progress-bar.h index 1eab64c5..55f5a480 100644 --- a/src/libply-splash-graphics/ply-progress-bar.h +++ b/src/libply-splash-graphics/ply-progress-bar.h @@ -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, diff --git a/src/plugins/splash/throbgress/plugin.c b/src/plugins/splash/throbgress/plugin.c index 4016d966..bbcf1b7c 100644 --- a/src/plugins/splash/throbgress/plugin.c +++ b/src/plugins/splash/throbgress/plugin.c @@ -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); }