Start using menu_entries_pop_stack

This commit is contained in:
twinaphex 2015-10-17 18:38:14 +02:00
parent c42e4c420f
commit d4c99a5f4e
6 changed files with 19 additions and 15 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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

View File

@ -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;

View File

@ -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);
}
}