mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-05-12 11:43:16 -04:00
list: fix GUI_EVENT_THEME_CHANGED timing issue
Initialize a list's dirty_tick to last_dirty_tick instead of to the current tick. Issue probably only affects the sim: To force a list to reinitialize using the GUI_EVENT_THEME_CHANGED event, last_dirty_tick is set to the current tick. list_is_dirty() checks whether the list viewport needs to be re-initialized by comparing the list's dirty tick to last_dirty_tick, and seeing if time has passed. In some scenarios though, the list's vp may be initialized, become immediately dirty, and list_is_dirty is called, all in the same tick. Change-Id: Ia379117a07bbaf545e0a16d35e74888955893441
This commit is contained in:
parent
02638c1cb8
commit
89d24f3bd4
1 changed files with 4 additions and 5 deletions
|
|
@ -59,17 +59,17 @@ static bool list_is_dirty(struct gui_synclist *list)
|
|||
return TIME_BEFORE(list->dirty_tick, last_dirty_tick);
|
||||
}
|
||||
|
||||
static void list_force_reinit(unsigned short id, void *param, void *last_dirty_tick)
|
||||
static void list_force_reinit(unsigned short id, void *param)
|
||||
{
|
||||
(void)id;
|
||||
(void)param;
|
||||
*(int *)last_dirty_tick = current_tick;
|
||||
last_dirty_tick = current_tick;
|
||||
}
|
||||
|
||||
void list_init(void)
|
||||
{
|
||||
last_dirty_tick = current_tick;
|
||||
add_event_ex(GUI_EVENT_THEME_CHANGED, false, list_force_reinit, &last_dirty_tick);
|
||||
add_event(GUI_EVENT_THEME_CHANGED, list_force_reinit);
|
||||
}
|
||||
|
||||
static void list_init_viewports(struct gui_synclist *list)
|
||||
|
|
@ -83,7 +83,7 @@ static void list_init_viewports(struct gui_synclist *list)
|
|||
gui_synclist_set_viewport_defaults(list->parent[i], i);
|
||||
}
|
||||
}
|
||||
list->dirty_tick = current_tick;
|
||||
list->dirty_tick = last_dirty_tick;
|
||||
}
|
||||
|
||||
static int list_nb_lines(struct gui_synclist *list, enum screen_type screen)
|
||||
|
|
@ -187,7 +187,6 @@ void gui_synclist_init(struct gui_synclist * gui_list,
|
|||
gui_list->title_icon = Icon_NOICON;
|
||||
|
||||
gui_list->scheduled_talk_tick = gui_list->last_talked_tick = 0;
|
||||
gui_list->dirty_tick = current_tick;
|
||||
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
gui_list->title_color = -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue