gui: list: update skin in gui_synclist_set_title

Moving the skin update from gui_synclist_set_title to
gui_synclist_draw (c41beeb) had the inadvertent side
effect that, if gui_synclist_select_item was called in
between, it may have missed a configured skinlist that
only got enabled by the skin update. Which could lead
to a selection appearing off screen.

This was mainly an issue if you had popped an activity,
which resets the skinlist cfg to NULL, but didn't perform
a skin update before the call to gui_synclist_select_item.

Now that GUI_EVENT_ACTIONREDRAW can be used instead of
GUI_EVENT_ACTIONUPDATE to prevent the display from being
updated, we may as well update the skin immediately in
gui_synclist_set_title again.

Change-Id: Iaee98d670ffb8d7b6590bd2ba11827fef5fba5a8
This commit is contained in:
Christian Soffke 2026-05-28 12:09:42 +02:00 committed by Solomon Peachy
parent 9f20c45a5e
commit 160905b1b8

View file

@ -49,8 +49,6 @@
void list_draw(struct screen *display, struct gui_synclist *list);
static long last_dirty_tick;
static bool sb_title_is_dirty;
static bool theme_enabled;
static struct viewport parent[NB_SCREENS];
static struct gui_synclist *current_lists;
@ -224,32 +222,11 @@ int gui_list_get_item_offset(struct gui_synclist * gui_list,
return item_offset;
}
static void sb_title_cb(unsigned short id, void *data, void *userdata)
{
(void)id;
(void)data;
theme_enabled = true;
gui_synclist_draw((struct gui_synclist *) userdata);
}
/*
* Force a full screen update.
*/
void gui_synclist_draw(struct gui_synclist *gui_list)
{
if (sb_title_is_dirty)
{
sb_title_is_dirty = theme_enabled = false;
/* Redraw skin, and make skin engine call us back */
add_event_ex(GUI_EVENT_NEED_UI_UPDATE, true, sb_title_cb, gui_list);
send_event(GUI_EVENT_ACTIONREDRAW, (void*)1);
remove_event_ex(GUI_EVENT_NEED_UI_UPDATE, sb_title_cb, gui_list);
/* sb_title_cb was only called if theme is enabled */
if (theme_enabled)
return;
}
if (list_is_dirty(gui_list))
{
list_init_viewports(gui_list);
@ -465,7 +442,7 @@ void gui_synclist_set_title(struct gui_synclist * gui_list,
gui_list->title_icon = icon;
FOR_NB_SCREENS(i)
sb_set_title_text(title, icon, i);
sb_title_is_dirty = true;
send_event(GUI_EVENT_ACTIONREDRAW, (void*)1);
}
void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items)