gui: delay updating SBS when setting list title

We currently force a skin refresh when setting the
list title. This causes very noticeable flickering
of the list, if the SBS draws over the UI viewport,
when there is no displayable list content yet
(For an example, check out the Adwaitapod theme).

Instead, only mark the title as dirty. Later, when
drawing the list, register for a UI update callback
and ask the skin engine to render, so that we can
draw the list at the same time.

Note: Flickering related to display updates when
switching activities or when toggling the theme is
unrelated to this, and will still need to be addressed
in separate commits.

Change-Id: Icce899905aa311deccb0cc498aacce2866aaae8a
This commit is contained in:
Christian Soffke 2026-04-29 09:07:41 +02:00 committed by Solomon Peachy
parent 7ab1a81806
commit c41beebcda

View file

@ -49,6 +49,8 @@
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;
@ -220,11 +222,32 @@ 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;
/* tell skin engine to refresh, then call us back */
add_event_ex(GUI_EVENT_NEED_UI_UPDATE, true, sb_title_cb, gui_list);
send_event(GUI_EVENT_ACTIONUPDATE, (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);
@ -439,7 +462,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);
send_event(GUI_EVENT_ACTIONUPDATE, (void*)1);
sb_title_is_dirty = true;
}
void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items)