diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2022-12-05 20:05:15 +0100 |
---|---|---|
committer | Christian Soffke <christian.soffke@gmail.com> | 2022-12-08 00:38:59 -0500 |
commit | 66a411a1ba6d3668b002760ce2d26bca42db894f (patch) | |
tree | 6af403e9a03c3785f805be1d2600a806ceb61bae /apps/tree.c | |
parent | a9a284c1a09f960a307d5eb9bcb9f4e92a1e7747 (diff) | |
download | rockbox-66a411a1ba6d3668b002760ce2d26bca42db894f.tar.gz rockbox-66a411a1ba6d3668b002760ce2d26bca42db894f.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
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 27 |
1 files changed, 9 insertions, 18 deletions
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 @@ | |||
80 | static const struct filetype *filetypes; | 80 | static const struct filetype *filetypes; |
81 | static int filetypes_count; | 81 | static int filetypes_count; |
82 | 82 | ||
83 | struct gui_synclist tree_lists; | 83 | static struct gui_synclist tree_lists; |
84 | 84 | ||
85 | /* I put it here because other files doesn't use it yet, | 85 | /* I put it here because other files doesn't use it yet, |
86 | * but should be elsewhere since it will be used mostly everywhere */ | 86 | * but should be elsewhere since it will be used mostly everywhere */ |
@@ -301,19 +301,10 @@ bool check_rockboxdir(void) | |||
301 | } | 301 | } |
302 | 302 | ||
303 | /* do this really late in the init sequence */ | 303 | /* do this really late in the init sequence */ |
304 | void tree_gui_init(void) | 304 | void tree_init(void) |
305 | { | 305 | { |
306 | check_rockboxdir(); | 306 | check_rockboxdir(); |
307 | |||
308 | strcpy(tc.currdir, "/"); | 307 | strcpy(tc.currdir, "/"); |
309 | |||
310 | gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1, NULL); | ||
311 | gui_synclist_set_voice_callback(&tree_lists, tree_voice_cb); | ||
312 | gui_synclist_set_icon_callback(&tree_lists, | ||
313 | global_settings.show_icons?&tree_get_fileicon:NULL); | ||
314 | #ifdef HAVE_LCD_COLOR | ||
315 | gui_synclist_set_color_callback(&tree_lists, &tree_get_filecolor); | ||
316 | #endif | ||
317 | } | 308 | } |
318 | 309 | ||
319 | 310 | ||
@@ -419,6 +410,9 @@ static int update_dir(void) | |||
419 | splash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL)); | 410 | splash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL)); |
420 | } | 411 | } |
421 | } | 412 | } |
413 | |||
414 | gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1, NULL); | ||
415 | |||
422 | #ifdef HAVE_TAGCACHE | 416 | #ifdef HAVE_TAGCACHE |
423 | if (id3db) | 417 | if (id3db) |
424 | { | 418 | { |
@@ -472,6 +466,10 @@ static int update_dir(void) | |||
472 | gui_synclist_set_nb_items(&tree_lists, tc.filesindir); | 466 | gui_synclist_set_nb_items(&tree_lists, tc.filesindir); |
473 | gui_synclist_set_icon_callback(&tree_lists, | 467 | gui_synclist_set_icon_callback(&tree_lists, |
474 | global_settings.show_icons?tree_get_fileicon:NULL); | 468 | global_settings.show_icons?tree_get_fileicon:NULL); |
469 | gui_synclist_set_voice_callback(&tree_lists, tree_voice_cb); | ||
470 | #ifdef HAVE_LCD_COLOR | ||
471 | gui_synclist_set_color_callback(&tree_lists, &tree_get_filecolor); | ||
472 | #endif | ||
475 | if( tc.selected_item >= tc.filesindir) | 473 | if( tc.selected_item >= tc.filesindir) |
476 | tc.selected_item=tc.filesindir-1; | 474 | tc.selected_item=tc.filesindir-1; |
477 | 475 | ||
@@ -657,8 +655,6 @@ static int dirbrowse(void) | |||
657 | return GO_TO_PREVIOUS; /* No files found for rockbox_browse() */ | 655 | return GO_TO_PREVIOUS; /* No files found for rockbox_browse() */ |
658 | } | 656 | } |
659 | 657 | ||
660 | send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */ | ||
661 | gui_synclist_draw(&tree_lists); | ||
662 | while(1) { | 658 | while(1) { |
663 | bool restore = false; | 659 | bool restore = false; |
664 | if (tc.dirlevel < 0) | 660 | if (tc.dirlevel < 0) |
@@ -706,9 +702,6 @@ static int dirbrowse(void) | |||
706 | #endif | 702 | #endif |
707 | case GO_TO_ROOT: exit_func = true; break; | 703 | case GO_TO_ROOT: exit_func = true; break; |
708 | default: | 704 | default: |
709 | if (*tc.dirfilter == SHOW_CFG) /* theme changed */ | ||
710 | gui_synclist_init_display_settings(&tree_lists); | ||
711 | |||
712 | break; | 705 | break; |
713 | } | 706 | } |
714 | restore = true; | 707 | restore = true; |
@@ -1000,8 +993,6 @@ int rockbox_browse(struct browse_context *browse) | |||
1000 | tc.dirfilter = &dirfilter; | 993 | tc.dirfilter = &dirfilter; |
1001 | tc.sort_dir = global_settings.sort_dir; | 994 | tc.sort_dir = global_settings.sort_dir; |
1002 | 995 | ||
1003 | gui_synclist_init_display_settings(&tree_lists); /* grab updated settings */ | ||
1004 | |||
1005 | reload_dir = true; | 996 | reload_dir = true; |
1006 | if (*tc.dirfilter >= NUM_FILTER_MODES) | 997 | if (*tc.dirfilter >= NUM_FILTER_MODES) |
1007 | { | 998 | { |