summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2022-12-05 20:05:15 +0100
committerChristian Soffke <christian.soffke@gmail.com>2022-12-08 00:38:59 -0500
commit66a411a1ba6d3668b002760ce2d26bca42db894f (patch)
tree6af403e9a03c3785f805be1d2600a806ceb61bae
parenta9a284c1a09f960a307d5eb9bcb9f4e92a1e7747 (diff)
downloadrockbox-66a411a1ba.tar.gz
rockbox-66a411a1ba.zip
Tree / Playlist Viewer / Menu: Fix redraw issues
1) Tree_lists was only initialized when booting the player. In cases where a skin used custom UI viewports of different sizes, when switching between screens, such as between root menu, QuickScreen, and tree browser, this caused list titles to appear with a significant delay, unless a GUI_EVENT_ACTIONUPDATE was sent. Tree_lists is now initialized when entering dirbrowse or when restoring/reloading the list. This eliminates multiple redundant UI refreshes when entering the tree browser, due to gui_synclist_draw not being called twice anymore and by being able to omit GUI_EVENT_ACTIONUPDATE. Separate calls to gui_synclist_init_display_settings have become unnecessary since it is already called by gui_synclist_init. 2) The synclist is also re-initialized when returning from the QuickScreen in the Playlist Viewer or regular menus, or when returning from Settings menus Change-Id: I2884249eda55f782e97abad9dc19b3d9d1267fc9
-rw-r--r--apps/main.c2
-rw-r--r--apps/menu.c6
-rw-r--r--apps/playlist_viewer.c2
-rw-r--r--apps/tree.c27
-rw-r--r--apps/tree.h3
5 files changed, 17 insertions, 23 deletions
diff --git a/apps/main.c b/apps/main.c
index f86d91e42e..8cf202243c 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -167,7 +167,7 @@ int main(void)
screens[i].update();
}
list_init();
- tree_gui_init();
+ tree_init();
/* Keep the order of this 3
* Must be done before any code uses the multi-screen API */
#ifdef HAVE_USBSTACK
diff --git a/apps/menu.c b/apps/menu.c
index eb3adcc037..48eea70454 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -466,6 +466,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
done = true;
}
}
+ if (!done)
+ init_menu_lists(menu, &lists, lists.selected_item, false, vps);
redraw_lists = true;
}
#endif
@@ -670,7 +672,9 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
case MT_SETTING_W_TEXT:
{
do_setting_from_menu(temp, vps);
- send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */
+ init_menu_lists(menu, &lists, selected, false, vps);
+ redraw_lists = true;
+
break;
}
case MT_RETURN_ID:
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 8f1c5d961d..4abd3ee1c5 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -1017,7 +1017,7 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename,
{
quick_screen_quick(button);
update_playlist(true);
- update_lists(&playlist_lists);
+ prepare_lists(&playlist_lists);
}
break;
#endif
diff --git a/apps/tree.c b/apps/tree.c
index 1149c19104..fa745319a9 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -80,7 +80,7 @@
static const struct filetype *filetypes;
static int filetypes_count;
-struct gui_synclist tree_lists;
+static struct gui_synclist tree_lists;
/* I put it here because other files doesn't use it yet,
* but should be elsewhere since it will be used mostly everywhere */
@@ -301,19 +301,10 @@ bool check_rockboxdir(void)
}
/* do this really late in the init sequence */
-void tree_gui_init(void)
+void tree_init(void)
{
check_rockboxdir();
-
strcpy(tc.currdir, "/");
-
- gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1, NULL);
- gui_synclist_set_voice_callback(&tree_lists, tree_voice_cb);
- gui_synclist_set_icon_callback(&tree_lists,
- global_settings.show_icons?&tree_get_fileicon:NULL);
-#ifdef HAVE_LCD_COLOR
- gui_synclist_set_color_callback(&tree_lists, &tree_get_filecolor);
-#endif
}
@@ -419,6 +410,9 @@ static int update_dir(void)
splash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL));
}
}
+
+ gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1, NULL);
+
#ifdef HAVE_TAGCACHE
if (id3db)
{
@@ -472,6 +466,10 @@ static int update_dir(void)
gui_synclist_set_nb_items(&tree_lists, tc.filesindir);
gui_synclist_set_icon_callback(&tree_lists,
global_settings.show_icons?tree_get_fileicon:NULL);
+ gui_synclist_set_voice_callback(&tree_lists, tree_voice_cb);
+#ifdef HAVE_LCD_COLOR
+ gui_synclist_set_color_callback(&tree_lists, &tree_get_filecolor);
+#endif
if( tc.selected_item >= tc.filesindir)
tc.selected_item=tc.filesindir-1;
@@ -657,8 +655,6 @@ static int dirbrowse(void)
return GO_TO_PREVIOUS; /* No files found for rockbox_browse() */
}
- send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */
- gui_synclist_draw(&tree_lists);
while(1) {
bool restore = false;
if (tc.dirlevel < 0)
@@ -706,9 +702,6 @@ static int dirbrowse(void)
#endif
case GO_TO_ROOT: exit_func = true; break;
default:
- if (*tc.dirfilter == SHOW_CFG) /* theme changed */
- gui_synclist_init_display_settings(&tree_lists);
-
break;
}
restore = true;
@@ -1000,8 +993,6 @@ int rockbox_browse(struct browse_context *browse)
tc.dirfilter = &dirfilter;
tc.sort_dir = global_settings.sort_dir;
- gui_synclist_init_display_settings(&tree_lists); /* grab updated settings */
-
reload_dir = true;
if (*tc.dirfilter >= NUM_FILTER_MODES)
{
diff --git a/apps/tree.h b/apps/tree.h
index 56fdb2e0bb..bb9ff87163 100644
--- a/apps/tree.h
+++ b/apps/tree.h
@@ -102,7 +102,7 @@ struct entry* tree_get_entries(struct tree_context *t);
struct entry* tree_get_entry_at(struct tree_context *t, int index);
void tree_mem_init(void) INIT_ATTR;
-void tree_gui_init(void) INIT_ATTR;
+void tree_init(void) INIT_ATTR;
char* get_current_file(char* buffer, size_t buffer_len);
void set_dirfilter(int l_dirfilter);
void set_current_file(const char *path);
@@ -133,5 +133,4 @@ void tree_restore(void);
bool bookmark_play(char* resume_file, int index, unsigned long elapsed,
unsigned long offset, int seed, char *filename);
-extern struct gui_synclist tree_lists;
#endif