mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(Menu) Refactor pointer_tap
This commit is contained in:
parent
5a17b79b48
commit
2f56d5f2d6
@ -1016,18 +1016,28 @@ static int pointer_tap(menu_file_list_cbs_t *cbs,
|
||||
menu_entry_t *entry, unsigned action)
|
||||
{
|
||||
size_t selection, idx;
|
||||
unsigned header_height;
|
||||
bool scroll = false;
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
|
||||
|
||||
if (menu_input->pointer.ptr == selection && cbs && cbs->action_select)
|
||||
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
||||
if ((unsigned)menu_input->pointer.start_y < header_height)
|
||||
{
|
||||
menu_entries_pop_stack(&selection, 0);
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
|
||||
}
|
||||
else if (menu_input->pointer.ptr <= (menu_entries_get_size() - 1))
|
||||
{
|
||||
if (menu_input->pointer.ptr == selection && cbs && cbs->action_select)
|
||||
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
||||
|
||||
idx = menu_input->pointer.ptr;
|
||||
idx = menu_input->pointer.ptr;
|
||||
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1151,18 +1161,7 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs,
|
||||
if (menu_input->pointer.oldpressed[0])
|
||||
{
|
||||
if (!menu_input->pointer.dragging)
|
||||
{
|
||||
if ((unsigned)menu_input->pointer.start_y < header_height)
|
||||
{
|
||||
menu_entries_pop_stack(&selection, 0);
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
|
||||
}
|
||||
else if (menu_input->pointer.ptr <= (menu_entries_get_size() - 1))
|
||||
{
|
||||
menu_input->pointer.oldpressed[0] = false;
|
||||
ret = pointer_tap(cbs, entry, action);
|
||||
}
|
||||
}
|
||||
ret = pointer_tap(cbs, entry, action);
|
||||
|
||||
menu_input->pointer.oldpressed[0] = false;
|
||||
menu_input->pointer.start_x = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user