1
0
Fork 0
forked from len0rd/rockbox

FS#13537: format_sound_value alignment issue in themes

Positive values included a leading space, which
meant they weren't displayed center-aligned in
themes anymore.

Change-Id: Ibe75e9b81a2989c87630dd3ea78e4b90c6c74502
This commit is contained in:
Christian Soffke 2025-01-02 02:10:16 +01:00
parent af7ed73f31
commit 384c35418a
3 changed files with 28 additions and 18 deletions

View file

@ -988,7 +988,6 @@ const char *get_token_value(struct gui_wps *gwps,
{
int numeric_ret = -1;
const char *numeric_buf = "?";
int fmt_size;
if (!gwps)
return NULL;
@ -1173,17 +1172,8 @@ const char *get_token_value(struct gui_wps *gwps,
break;
case SKIN_TOKEN_VOLUME:
fmt_size = format_sound_value(buf, buf_size, SOUND_VOLUME,
global_settings.volume);
/* FIXME: this is a cheap hack to avoid breaking existing themes.
* The new formatting includes a unit based on the AUDIOHW_SETTING
* definition -- on all targets, it's defined to be "dB". But the
* old formatting was just an integer value, and many themes append
* "dB" manually. So we need to strip the unit to unbreak all those
* existing themes.
*/
if(fmt_size >= 3 && !strcmp(&buf[fmt_size - 3], " dB"))
buf[fmt_size - 3] = 0;
format_sound_value_ex(buf, buf_size, SOUND_VOLUME,
global_settings.volume, true);
if (intval)
{