Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

make splash_progress lock to screen width on repeated calls

when calling splash, splash_progress repeatedly text rearranges and
the width changes leaving artifacts on the screen from the previously
displayed prompt

save the max width seen between calls to ensure the splash
prompt is never more narrow.

Height could be stored in a
similar manner but I deemed it unnecessary as typically the
text gets longer and the prompt increases in height
while the reflow causes the prompt to get more narrow.

keep track of the current activity and reset the max_width
when activities change (except bootloader)

Change-Id: I3303bd9135ab1d7bcf28bd5c28d0ab5346bf2697

+21 -1
+21 -1
apps/gui/splash.c
··· 32 32 #include "strptokspn_r.h" 33 33 #include "scrollbar.h" 34 34 #include "font.h" 35 + #ifndef BOOTLOADER 36 + #include "misc.h" /* get_current_activity */ 37 + #endif 35 38 36 39 static long progress_next_tick = 0; 37 40 ··· 43 46 static bool splash_internal(struct screen * screen, const char *fmt, va_list ap, 44 47 struct viewport *vp, int addl_lines) 45 48 { 49 + static int max_width[NB_SCREENS] = {2*RECT_SPACING}; 50 + #ifndef BOOTLOADER 51 + static enum current_activity last_act = ACTIVITY_UNKNOWN; 52 + enum current_activity act = get_current_activity(); 53 + 54 + if (last_act != act) /* changed activities reset max_width */ 55 + { 56 + FOR_NB_SCREENS(i) 57 + max_width[i] = 2*RECT_SPACING; 58 + last_act = act; 59 + } 60 + #endif 61 + /* prevent screen artifacts by keeping the max width seen */ 62 + int min_width = max_width[screen->screen_type]; 46 63 char splash_buf[MAXBUFFER]; 47 64 struct splash_lines { 48 65 const char *str; ··· 56 73 int y, i; 57 74 int space_w, w, chr_h; 58 75 int width, height; 59 - int maxw = 0; 76 + int maxw = min_width - 2*RECT_SPACING; 60 77 int fontnum = vp->font; 61 78 62 79 char lastbrkchr; ··· 145 162 vp->y += (vp->height - height) / 2; 146 163 vp->width = width; 147 164 vp->height = height; 165 + 166 + /* prevent artifacts by locking to max width observed on repeated calls */ 167 + max_width[screen->screen_type] = width; 148 168 149 169 vp->flags |= VP_FLAG_ALIGN_CENTER; 150 170 #if LCD_DEPTH > 1