From 51c1e3ce7fa2874f2b1afd0788ff7d2beba6a96e Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Thu, 3 Nov 2022 18:28:16 +0100 Subject: [PATCH] Shortcuts: Fix return to wrong menu Rockbox would go to a previously selected menu instead of returning to the current one when leaving the Shortcuts screen. Change-Id: I3546e32def9124956cd9edc258e14db91d19fa22 --- apps/menu.c | 11 +++++++++-- apps/tree.c | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/menu.c b/apps/menu.c index c86ada1986..d8d1b6b081 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -458,9 +458,16 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, if (global_settings.shortcuts_replaces_qs || quick_screen_quick(action) == QUICKSCREEN_GOTO_SHORTCUTS_MENU) { + int last_screen = global_status.last_screen; global_status.last_screen = GO_TO_SHORTCUTMENU; - ret = do_shortcut_menu(NULL); - done = true; + int shortcut_ret = do_shortcut_menu(NULL); + if (shortcut_ret == GO_TO_PREVIOUS) + global_status.last_screen = last_screen; + else + { + ret = shortcut_ret; + done = true; + } } redraw_lists = true; } diff --git a/apps/tree.c b/apps/tree.c index cb7c033b6f..70f2704fae 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -766,8 +766,13 @@ static int dirbrowse(void) if (enter_shortcuts_menu && *tc.dirfilter < NUM_FILTER_MODES) { + int last_screen = global_status.last_screen; global_status.last_screen = GO_TO_SHORTCUTMENU; - return do_shortcut_menu(NULL); + int shortcut_ret = do_shortcut_menu(NULL); + if (shortcut_ret == GO_TO_PREVIOUS) + global_status.last_screen = last_screen; + else + return shortcut_ret; } restore = true;