diff mbox series

[psplash,1/2] Add configure flags to set progression bar size

Message ID 20251120210348.88193-1-gael.portay+rtone@gmail.com
State New
Headers show
Series [psplash,1/2] Add configure flags to set progression bar size | expand

Commit Message

Gaël PORTAY Nov. 20, 2025, 9:03 p.m. UTC
Added --progress-bar-border-size configure option to set progress bar
border size without patching the code. Default behaviour is to show a
progress bar with a 4-pixel border size.

Signed-off-by: Gaël PORTAY <gael.portay+rtone@gmail.com>
---
 configure.ac     |  8 ++++++++
 psplash-config.h |  5 +++++
 psplash.c        | 10 +++++-----
 3 files changed, 18 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index 110ce32..a64990a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,14 @@  AS_IF([test "x$enable_progress_bar" = "xno"], [
     EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -DPSPLASH_DISABLE_PROGRESS_BAR"
 ])
 
+AC_ARG_WITH([progress-bar-border-size],
+    AS_HELP_STRING([--with-progress-bar-border-size=SIZE], [Set progress bar border size (default is 4 pixel)]),
+    [with_progress_bar_border_size=$withval],
+    [with_progress_bar_border_size=4])
+AS_IF([test "x$with_progress_bar_border_size" != "xyes"], [
+    EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -DPSPLASH_PROGRESS_BAR_BORDER_SIZE=$with_progress_bar_border_size"
+])
+
 AC_ARG_ENABLE([img-fullscreen],
     AS_HELP_STRING([--enable-img-fullscreen], [Enable the logo image in fullscreen mode)]),
     [enable_img_fullscreen=$enableval],
diff --git a/psplash-config.h b/psplash-config.h
index eb90ef3..c7fff81 100644
--- a/psplash-config.h
+++ b/psplash-config.h
@@ -26,6 +26,11 @@ 
 #define PSPLASH_SHOW_PROGRESS_BAR 1
 #endif
 
+/* Size of the progress bar */
+#ifndef PSPLASH_PROGRESS_BAR_BORDER_SIZE
+#define PSPLASH_PROGRESS_BAR_BORDER_SIZE 4
+#endif
+
 /* Position of the image split from top edge, numerator of fraction */
 #define PSPLASH_IMG_SPLIT_NUMERATOR 5
 
diff --git a/psplash.c b/psplash.c
index 261dd1c..fbd51d0 100644
--- a/psplash.c
+++ b/psplash.c
@@ -67,11 +67,11 @@  psplash_draw_progress (PSplashFB *fb, int value)
 {
   int x, y, width, height, barwidth;
 
-  /* 4 pix border */
-  x      = ((fb->width  - BAR_IMG_WIDTH)/2) + 4 ;
-  y      = SPLIT_LINE_POS(fb) + 4;
-  width  = BAR_IMG_WIDTH - 8; 
-  height = BAR_IMG_HEIGHT - 8;
+  /* n pix border */
+  x      = ((fb->width  - BAR_IMG_WIDTH)/2) + PSPLASH_PROGRESS_BAR_BORDER_SIZE;
+  y      = SPLIT_LINE_POS(fb) + PSPLASH_PROGRESS_BAR_BORDER_SIZE;
+  width  = BAR_IMG_WIDTH - 2 * PSPLASH_PROGRESS_BAR_BORDER_SIZE;
+  height = BAR_IMG_HEIGHT - 2 * PSPLASH_PROGRESS_BAR_BORDER_SIZE;
 
   if (value > 0)
     {