Add unified back action to all menu drivers (#14856)

This commit is contained in:
sonninnos 2023-01-16 09:51:07 +02:00 committed by GitHub
parent 127c676048
commit 4191e0a9d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 67 additions and 0 deletions

View file

@ -9353,6 +9353,18 @@ static enum menu_action materialui_parse_menu_entry_action(
materialui_switch_tabs(mui, main_menu_tab, MENU_ACTION_NOOP);
new_action = MENU_ACTION_NOOP;
}
else if (main_menu_tab_index == mui->nav_bar.active_menu_tab_index)
{
/* Jump to first item on Main Menu */
menu_navigation_set_selection(0);
materialui_navigation_set(mui, true);
}
}
else if (materialui_list_get_size(mui, MENU_LIST_PLAIN) == 1)
{
/* Jump to first item on current menu */
menu_navigation_set_selection(0);
materialui_navigation_set(mui, true);
}
break;
default:

View file

@ -8062,6 +8062,12 @@ static enum menu_action ozone_parse_menu_entry_action(
audio_driver_mixer_play_scroll_sound(true);
#endif
}
else
{
/* Jump to first item on Main Menu */
ozone->tab_selection[ozone->categories_selection_ptr] = 0;
menu_navigation_set_selection(0);
}
new_action = MENU_ACTION_ACCESSIBILITY_SPEAK_TITLE;
break;

View file

@ -7873,6 +7873,13 @@ static enum menu_action rgui_parse_menu_entry_action(
rgui_toggle_fs_thumbnail(rgui, config_get_ptr()->bools.menu_rgui_inline_thumbnails);
new_action = MENU_ACTION_NOOP;
}
if (string_is_equal(rgui->menu_title, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MAIN_MENU)))
{
/* Jump to first item on Main Menu */
menu_navigation_set_selection(0);
new_action = MENU_ACTION_NOOP;
}
break;
case MENU_ACTION_START:
/* Playlist thumbnail fullscreen toggle */

View file

@ -2089,6 +2089,9 @@ static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb)
iz = xmb->categories_active_zoom;
}
if (!xmb->allow_horizontal_animation)
continue;
/* Horizontal icon animation */
entry.target_value = ia;
@ -4463,6 +4466,10 @@ static bool INLINE xmb_fullscreen_thumbnails_available(xmb_handle_t *xmb)
extern int action_switch_thumbnail(const char *path,
const char *label, unsigned type, size_t idx);
static int xmb_menu_entry_action(
void *userdata, menu_entry_t *entry,
size_t i, enum menu_action action);
static enum menu_action xmb_parse_menu_entry_action(
xmb_handle_t *xmb, enum menu_action action)
{
@ -4598,6 +4605,41 @@ static enum menu_action xmb_parse_menu_entry_action(
xmb->want_fullscreen_thumbnails = false;
return MENU_ACTION_NOOP;
}
/* Back up to Main Menu and first item */
if (menu_entries_get_stack_size(0) == 1)
{
if (xmb_get_system_tab(xmb,
(unsigned)xmb->categories_selection_ptr) == XMB_SYSTEM_TAB_MAIN)
{
/* Jump to first item on Main Menu */
menu_navigation_set_selection(0);
xmb_selection_pointer_changed(xmb, true);
}
else
{
/* Jump to Main Menu */
size_t i = 0;
size_t current_tab = xmb->categories_selection_ptr;
menu_entry_t entry;
MENU_ENTRY_INITIALIZE(entry);
menu_entry_get(&entry, 0, menu_navigation_get_selection(), NULL, true);
/* Icon animations get stuck if they happen too fast,
therefore allow it only on the last action */
xmb->allow_horizontal_animation = false;
for (i = 0; i < current_tab; i++)
{
if (i == current_tab - 1)
xmb->allow_horizontal_animation = true;
xmb_menu_entry_action(xmb,
&entry, menu_navigation_get_selection(), MENU_ACTION_LEFT);
}
}
return MENU_ACTION_NOOP;
}
break;
case MENU_ACTION_UP:
case MENU_ACTION_DOWN: