Fix touch back button code

This commit is contained in:
twinaphex 2016-06-22 06:48:35 +02:00
parent 735dc822ca
commit f5fcd45a3f
3 changed files with 27 additions and 26 deletions

View File

@ -1450,28 +1450,27 @@ static int mui_pointer_tap(void *userdata,
unsigned ptr, menu_file_list_cbs_t *cbs, unsigned ptr, menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action) menu_entry_t *entry, unsigned action)
{ {
size_t selection, idx; size_t selection;
unsigned header_height, width, height, i; unsigned width, height;
bool scroll = false; unsigned header_height, i;
mui_handle_t *mui = (mui_handle_t*)userdata; mui_handle_t *mui = (mui_handle_t*)userdata;
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
if (!mui) if (!mui)
return 0; return 0;
video_driver_get_size(&width, &height);
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
header_height = menu_display_get_header_height(); header_height = menu_display_get_header_height();
video_driver_get_size(&width, &height);
if (y < header_height) if (y < header_height)
{ {
menu_entries_pop_stack(&selection, 0, 1); menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); return menu_entry_action(entry, selection, MENU_ACTION_CANCEL);
} }
else if (y > height - mui->tabs_height) else if (y > height - mui->tabs_height)
{ {
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
for (i = 0; i <= MUI_SYSTEM_TAB_END; i++) for (i = 0; i <= MUI_SYSTEM_TAB_END; i++)
{ {
unsigned tab_width = width / (MUI_SYSTEM_TAB_END + 1); unsigned tab_width = width / (MUI_SYSTEM_TAB_END + 1);
@ -1491,6 +1490,9 @@ static int mui_pointer_tap(void *userdata,
} }
else if (ptr <= (menu_entries_get_size() - 1)) else if (ptr <= (menu_entries_get_size() - 1))
{ {
size_t idx;
bool scroll = false;
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
if (ptr == selection && cbs && cbs->action_select) if (ptr == selection && cbs && cbs->action_select)
return menu_entry_action(entry, selection, MENU_ACTION_SELECT); return menu_entry_action(entry, selection, MENU_ACTION_SELECT);

View File

@ -850,20 +850,19 @@ static int rgui_pointer_tap(void *data,
unsigned ptr, menu_file_list_cbs_t *cbs, unsigned ptr, menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action) menu_entry_t *entry, unsigned action)
{ {
size_t selection, idx; size_t selection;
unsigned header_height; unsigned header_height = menu_display_get_header_height();
bool scroll = false;
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
header_height = menu_display_get_header_height();
if (y < header_height) if (y < header_height)
{ {
menu_entries_pop_stack(&selection, 0, 1); menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); return menu_entry_action(entry, selection, MENU_ACTION_CANCEL);
} }
else if (ptr <= (menu_entries_get_size() - 1)) else if (ptr <= (menu_entries_get_size() - 1))
{ {
size_t idx;
bool scroll = false;
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
if (ptr == selection && cbs && cbs->action_select) if (ptr == selection && cbs && cbs->action_select)
return menu_entry_action(entry, selection, MENU_ACTION_SELECT); return menu_entry_action(entry, selection, MENU_ACTION_SELECT);

View File

@ -3221,20 +3221,20 @@ static int xmb_pointer_tap(void *userdata,
menu_file_list_cbs_t *cbs, menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action) menu_entry_t *entry, unsigned action)
{ {
size_t selection, idx; size_t selection;
unsigned header_height; unsigned header_height = menu_display_get_header_height();
bool scroll = false;
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
header_height = menu_display_get_header_height();
if (y < header_height) if (y < header_height)
{ {
menu_entries_pop_stack(&selection, 0, 1); menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); return menu_entry_action(entry, selection, MENU_ACTION_CANCEL);
} }
else if (ptr <= (menu_entries_get_size() - 1)) else if (ptr <= (menu_entries_get_size() - 1))
{ {
size_t idx;
bool scroll = false;
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
if (ptr == selection && cbs && cbs->action_select) if (ptr == selection && cbs && cbs->action_select)
return menu_entry_action(entry, selection, MENU_ACTION_SELECT); return menu_entry_action(entry, selection, MENU_ACTION_SELECT);