summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-11-07 01:56:49 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2021-11-07 01:49:15 -0500
commit1d67f83c587cce30a9afa10f966cc04a86adb87b (patch)
tree8e8b1e7255c798405d8ad15d8d7e575c6bcc439e /apps
parent13ac48562544eada909ee39a63d5b87afe51b219 (diff)
downloadrockbox-1d67f83c587cce30a9afa10f966cc04a86adb87b.tar.gz
rockbox-1d67f83c587cce30a9afa10f966cc04a86adb87b.zip
root_menu.c fix recent regression for shortcuts add resume for plugins
recent changes broke shortcuts when they originated from the root menu I mistakenly thought GO_TO_ROOT only happened at start and otherwise was GO_TO_PREVIOUS this commit also adds a few missing features for Start In Previous to resume the last plugin running at shutdown Additionally GO_TO_ROOT now overwrites the global last_screen so you can return to the main menu on next startup Change-Id: I86bf842616e25dc3d4f684ff9d476e6a5ba96b04
Diffstat (limited to 'apps')
-rw-r--r--apps/open_plugin.c9
-rw-r--r--apps/root_menu.c38
2 files changed, 40 insertions, 7 deletions
diff --git a/apps/open_plugin.c b/apps/open_plugin.c
index d16502ecbe..f7f55d58cd 100644
--- a/apps/open_plugin.c
+++ b/apps/open_plugin.c
@@ -374,6 +374,15 @@ int open_plugin_run(const char *key)
374void open_plugin_cache_flush(void) 374void open_plugin_cache_flush(void)
375{ 375{
376 logf("OP *cache flush*"); 376 logf("OP *cache flush*");
377 /* start_in_screen == 0 is 'Previous Screen' it is actually
378 * defined as (GO_TO_PREVIOUS = -2) + 2 for *Legacy?* reasons AFAICT */
379 if (global_settings.start_in_screen == 0 &&
380 global_status.last_screen == GO_TO_PLUGIN &&
381 open_plugin_entry.lang_id > OPEN_PLUGIN_LANG_INVALID)
382 {
383 /* flush the last item as LANG_PREVIOUS_SCREEN if the user wants to resume */
384 open_plugin_entry.lang_id = LANG_PREVIOUS_SCREEN;
385 }
377 op_update_dat(&open_plugin_entry, true); 386 op_update_dat(&open_plugin_entry, true);
378} 387}
379 388
diff --git a/apps/root_menu.c b/apps/root_menu.c
index f731531e16..16c45c1509 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -727,7 +727,7 @@ static int load_plugin_screen(char *key)
727 727
728 int ret = plugin_load(path, param); 728 int ret = plugin_load(path, param);
729 729
730 if (ret == PLUGIN_USB_CONNECTED) 730 if (ret == PLUGIN_USB_CONNECTED || ret == PLUGIN_ERROR)
731 ret_val = GO_TO_ROOT; 731 ret_val = GO_TO_ROOT;
732 else if (ret == PLUGIN_GOTO_WPS) 732 else if (ret == PLUGIN_GOTO_WPS)
733 ret_val = GO_TO_WPS; 733 ret_val = GO_TO_WPS;
@@ -735,13 +735,15 @@ static int load_plugin_screen(char *key)
735 continue; 735 continue;
736 else 736 else
737 { 737 {
738 /* Prevents infinite loop with WPS & Plugins*/ 738 /* Prevents infinite loop with WPS, Plugins, Previous Screen*/
739 if (ret == PLUGIN_OK && old_global == GO_TO_WPS && !audio_status()) 739 if (ret == PLUGIN_OK && old_global == GO_TO_WPS && !audio_status())
740 ret_val = GO_TO_ROOT; 740 ret_val = GO_TO_ROOT;
741 ret_val = GO_TO_PREVIOUS; 741 ret_val = GO_TO_PREVIOUS;
742 last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous; 742 last_screen = (old_previous == next_screen || old_global == GO_TO_ROOT)
743 ? GO_TO_ROOT : old_previous;
744 if (last_screen == GO_TO_ROOT)
745 global_status.last_screen = GO_TO_ROOT;
743 } 746 }
744
745 /* ret_val != GO_TO_PLUGIN */ 747 /* ret_val != GO_TO_PLUGIN */
746 748
747 if (opret != OPEN_PLUGIN_NEEDS_FLUSHED || last_screen != GO_TO_WPS) 749 if (opret != OPEN_PLUGIN_NEEDS_FLUSHED || last_screen != GO_TO_WPS)
@@ -772,6 +774,29 @@ static int root_menu_setup_screens(void)
772 if (global_settings.start_in_screen == 0) 774 if (global_settings.start_in_screen == 0)
773 new_screen = (int)global_status.last_screen; 775 new_screen = (int)global_status.last_screen;
774 else new_screen = global_settings.start_in_screen - 2; 776 else new_screen = global_settings.start_in_screen - 2;
777 if (new_screen == GO_TO_PLUGIN)
778 {
779 if (global_status.last_screen == GO_TO_SHORTCUTMENU)
780 {
781 /* Can make this any value other than GO_TO_SHORTCUTMENU
782 otherwise it takes over on startup when the user wanted
783 the plugin at key - LANG_START_SCREEN */
784 global_status.last_screen = GO_TO_PLUGIN;
785 }
786 if(global_status.last_screen == GO_TO_SHORTCUTMENU ||
787 global_status.last_screen == GO_TO_PLUGIN)
788 {
789 if (global_settings.start_in_screen == 0)
790 { /* Start in: Previous Screen */
791 last_screen = GO_TO_PREVIOUS;
792 global_status.last_screen = GO_TO_ROOT;
793 /* since the plugin has GO_TO_PLUGIN as origin it
794 will just return GO_TO_PREVIOUS <=> GO_TO_PLUGIN in a loop
795 To allow exit after restart we check for GO_TO_ROOT
796 if so exit to ROOT after the plugin exits */
797 }
798 }
799 }
775#if CONFIG_TUNER 800#if CONFIG_TUNER
776 add_event(PLAYBACK_EVENT_START_PLAYBACK, rootmenu_start_playback_callback); 801 add_event(PLAYBACK_EVENT_START_PLAYBACK, rootmenu_start_playback_callback);
777#endif 802#endif
@@ -841,7 +866,7 @@ void root_menu(void)
841 case GO_TO_ROOT: 866 case GO_TO_ROOT:
842 if (last_screen != GO_TO_ROOT) 867 if (last_screen != GO_TO_ROOT)
843 selected = get_selection(last_screen); 868 selected = get_selection(last_screen);
844 869 global_status.last_screen = GO_TO_ROOT; /* We've returned to ROOT */
845 /* When we are in the main menu we want the hardware BACK 870 /* When we are in the main menu we want the hardware BACK
846 * button to be handled by HOST instead of rockbox */ 871 * button to be handled by HOST instead of rockbox */
847 ignore_back_button_stub(true); 872 ignore_back_button_stub(true);
@@ -889,8 +914,7 @@ void root_menu(void)
889 case GO_TO_PLUGIN: 914 case GO_TO_PLUGIN:
890 { 915 {
891 char *key; 916 char *key;
892 if (global_status.last_screen == GO_TO_SHORTCUTMENU && 917 if (global_status.last_screen == GO_TO_SHORTCUTMENU)
893 last_screen != GO_TO_ROOT)
894 { 918 {
895 shortcut_origin = last_screen; 919 shortcut_origin = last_screen;
896 key = ID2P(LANG_SHORTCUTS); 920 key = ID2P(LANG_SHORTCUTS);