diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index e1c11c9c00..04dac590f2 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -492,7 +492,7 @@ static int action_ok_playlist_entry(const char *path, { case MENU_LABEL_COLLECTION: case MENU_LABEL_RDB_ENTRY_START_CONTENT: - menu_list_pop_stack(menu_list, &selection); + menu_entries_pop_stack(&selection); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); break; default: @@ -852,8 +852,7 @@ static int action_ok_core_deferred_set(const char *path, size_t selection; char core_display_name[PATH_MAX_LENGTH]; menu_handle_t *menu = menu_driver_get_ptr(); - menu_list_t *menu_list = menu_list_get_ptr(); - if (!menu || !menu_list) + if (!menu) return -1; if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection)) return -1; @@ -872,7 +871,7 @@ static int action_ok_core_deferred_set(const char *path, content_playlist_write_file(menu->playlist); - menu_list_pop_stack(menu_list, &selection); + menu_entries_pop_stack(&selection); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); return -1; diff --git a/menu/drivers/menu_generic.c b/menu/drivers/menu_generic.c index a390494505..618b5c9d8b 100644 --- a/menu/drivers/menu_generic.c +++ b/menu/drivers/menu_generic.c @@ -244,7 +244,7 @@ int generic_menu_iterate(enum menu_action action) case ITERATE_TYPE_BIND: if (menu_input_key_bind_iterate(menu->menu_state.msg, sizeof(menu->menu_state.msg))) { - menu_list_pop_stack(menu_list, &selection); + menu_entries_pop_stack(&selection); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); } else @@ -305,7 +305,7 @@ int generic_menu_iterate(enum menu_action action) if (BIT64_GET(menu->state, MENU_STATE_POP_STACK)) { size_t new_selection_ptr = selection; - menu_list_pop_stack(menu_list, &new_selection_ptr); + menu_entries_pop_stack(&new_selection_ptr); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); } diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 3d34d95a5d..27939cd1ae 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -302,3 +302,10 @@ void menu_entries_get_last_stack(const char **path, const char **label, if (menu_list) menu_list_get_last_stack(menu_list, path, label, file_type, entry_idx); } + +void menu_entries_pop_stack(size_t *ptr) +{ + menu_list_t *menu_list = menu_list_get_ptr(); + if (menu_list) + menu_list_pop_stack(menu_list, ptr); +} diff --git a/menu/menu_entries.h b/menu/menu_entries.h index 63e13beb95..8cf24bd9a5 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -70,6 +70,8 @@ void menu_entries_new_list(menu_entries_t *entries, unsigned flags); void menu_entries_get_last_stack(const char **path, const char **label, unsigned *file_type, size_t *entry_idx); +void menu_entries_pop_stack(size_t *ptr); + #ifdef __cplusplus } #endif diff --git a/menu/menu_entry.c b/menu/menu_entry.c index e513285665..b292613fe6 100644 --- a/menu/menu_entry.c +++ b/menu/menu_entry.c @@ -35,12 +35,9 @@ int menu_entry_go_back(void) { size_t new_selection_ptr; - menu_list_t *menu_list = menu_list_get_ptr(); - if (!menu_list) - return -1; menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &new_selection_ptr); - menu_list_pop_stack(menu_list, &new_selection_ptr); + menu_entries_pop_stack(&new_selection_ptr); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &new_selection_ptr); return 0; diff --git a/menu/menu_input.c b/menu/menu_input.c index a291b1e131..1473fb3693 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -897,7 +897,6 @@ static int menu_input_mouse_frame( { size_t selection; menu_input_t *menu_input = menu_input_get_ptr(); - menu_list_t *menu_list = menu_list_get_ptr(); menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); @@ -917,7 +916,7 @@ static int menu_input_mouse_frame( if (BIT64_GET(input_mouse, MOUSE_ACTION_BUTTON_R)) { - menu_list_pop_stack(menu_list, &selection); + menu_entries_pop_stack(&selection); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); } @@ -974,7 +973,7 @@ static int menu_input_mouse_post_iterate(uint64_t *input_mouse, if ((unsigned)menu_input->mouse.y < header_height) { - menu_list_pop_stack(menu_list, &selection); + menu_entries_pop_stack(&selection); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); return 0; } @@ -1140,7 +1139,7 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs, { if ((unsigned)menu_input->pointer.start_y < header_height) { - menu_list_pop_stack(menu_list, &selection); + menu_entries_pop_stack(&selection); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); } else if (menu_input->pointer.ptr <= menu_list_get_size(menu_list)-1) @@ -1166,7 +1165,7 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs, if (!menu_input->pointer.oldback) { menu_input->pointer.oldback = true; - menu_list_pop_stack(menu_list, &selection); + menu_entries_pop_stack(&selection); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); } }