From f5fcd45a3f08ec39f19ee339447ddcf1ecfe1557 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 22 Jun 2016 06:48:35 +0200 Subject: [PATCH] Fix touch back button code --- menu/drivers/materialui.c | 22 ++++++++++++---------- menu/drivers/rgui.c | 15 +++++++-------- menu/drivers/xmb.c | 16 ++++++++-------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index acabd9f112..8de15975d0 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -1450,28 +1450,27 @@ static int mui_pointer_tap(void *userdata, unsigned ptr, menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action) { - size_t selection, idx; - unsigned header_height, width, height, i; - bool scroll = false; + size_t selection; + unsigned width, height; + unsigned header_height, i; 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) return 0; - video_driver_get_size(&width, &height); - - menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); header_height = menu_display_get_header_height(); + video_driver_get_size(&width, &height); if (y < header_height) { - menu_entries_pop_stack(&selection, 0, 1); - menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); + menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); + return menu_entry_action(entry, selection, MENU_ACTION_CANCEL); } 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++) { 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)) { + size_t idx; + bool scroll = false; + menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); if (ptr == selection && cbs && cbs->action_select) return menu_entry_action(entry, selection, MENU_ACTION_SELECT); diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 9669fa7aa8..365f66a314 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -850,20 +850,19 @@ static int rgui_pointer_tap(void *data, unsigned ptr, menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action) { - size_t selection, idx; - unsigned header_height; - bool scroll = false; - - menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); - header_height = menu_display_get_header_height(); + size_t selection; + unsigned header_height = menu_display_get_header_height(); if (y < header_height) { - menu_entries_pop_stack(&selection, 0, 1); - menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); + menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); + return menu_entry_action(entry, selection, MENU_ACTION_CANCEL); } 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) return menu_entry_action(entry, selection, MENU_ACTION_SELECT); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 5bcb904332..2232046490 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -3221,20 +3221,20 @@ static int xmb_pointer_tap(void *userdata, menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action) { - size_t selection, idx; - unsigned header_height; - bool scroll = false; - - menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); - header_height = menu_display_get_header_height(); + size_t selection; + unsigned header_height = menu_display_get_header_height(); if (y < header_height) { - menu_entries_pop_stack(&selection, 0, 1); - menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); + menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); + return menu_entry_action(entry, selection, MENU_ACTION_CANCEL); } 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) return menu_entry_action(entry, selection, MENU_ACTION_SELECT);