diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 6de160b05a..d8585d807b 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -1426,13 +1426,13 @@ static size_t glui_list_get_selection(void *data) return glui->categories.selection_ptr; } -static int glui_pointer_tap(menu_file_list_cbs_t *cbs, +static int glui_pointer_tap(unsigned x, unsigned y, + 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; - menu_input_t *menu_input = menu_input_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr(); glui_handle_t *glui = menu ? (glui_handle_t*)menu->userdata : NULL; file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); @@ -1446,20 +1446,19 @@ static int glui_pointer_tap(menu_file_list_cbs_t *cbs, menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height); - if ((unsigned)menu_input->pointer.start_y < header_height) + if (y < header_height) { menu_entries_pop_stack(&selection, 0); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); } - else if ((unsigned)menu_input->pointer.start_y > height - glui->tabs_height) + else if (y > height - glui->tabs_height) { for (i = 0; i <= GLUI_SYSTEM_TAB_END; i++) { unsigned tab_width = width / (GLUI_SYSTEM_TAB_END + 1); unsigned start = tab_width * i; - if ((unsigned)menu_input->pointer.start_x >= start && - (unsigned)menu_input->pointer.start_x < start + tab_width) + if ((x >= start) && (x < (start + tab_width))) { glui->categories.selection_ptr = i; @@ -1471,12 +1470,12 @@ static int glui_pointer_tap(menu_file_list_cbs_t *cbs, } } } - else if (menu_input->pointer.ptr <= (menu_entries_get_size() - 1)) + else if (ptr <= (menu_entries_get_size() - 1)) { - if (menu_input->pointer.ptr == selection && cbs && cbs->action_select) + if (ptr == selection && cbs && cbs->action_select) return menu_entry_action(entry, selection, MENU_ACTION_SELECT); - idx = menu_input->pointer.ptr; + idx = ptr; menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 0df1109cdb..f0d33f0c48 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2723,28 +2723,28 @@ static bool xmb_menu_init_list(void *data) return true; } -static int xmb_pointer_tap(menu_file_list_cbs_t *cbs, +static int xmb_pointer_tap(unsigned x, unsigned y, 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_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 ((unsigned)menu_input->pointer.start_y < header_height) + if (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)) + else if (ptr <= (menu_entries_get_size() - 1)) { - if (menu_input->pointer.ptr == selection && cbs && cbs->action_select) + if (ptr == selection && cbs && cbs->action_select) return menu_entry_action(entry, selection, MENU_ACTION_SELECT); - idx = menu_input->pointer.ptr; + idx = ptr; menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll); diff --git a/menu/menu_driver.c b/menu/menu_driver.c index d47a993c8d..8b8848c55d 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -393,14 +393,15 @@ bool menu_environment_cb(menu_environ_cb_t type, void *data) return false; } -int menu_driver_pointer_tap(menu_file_list_cbs_t *cbs, +int menu_driver_pointer_tap(unsigned x, unsigned y, unsigned ptr, + menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action) { int ret = 0; const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr(); if (driver->pointer_tap) - ret = driver->pointer_tap(cbs, entry, action); + ret = driver->pointer_tap(x, y, ptr, cbs, entry, action); return ret; } diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 7eaac07ce9..13135a9151 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -142,7 +142,8 @@ typedef struct menu_ctx_driver const char *ident; menu_video_driver_type_t type; int (*environ_cb)(menu_environ_cb_t type, void *data); - int (*pointer_tap)(menu_file_list_cbs_t *cbs, + int (*pointer_tap)(unsigned x, unsigned y, unsigned ptr, + menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action); } menu_ctx_driver_t; @@ -230,7 +231,8 @@ int menu_driver_bind_init(menu_file_list_cbs_t *cbs, const char *elem0, const char *elem1, uint32_t label_hash, uint32_t menu_label_hash); -int menu_driver_pointer_tap(menu_file_list_cbs_t *cbs, +int menu_driver_pointer_tap(unsigned x, unsigned y, unsigned ptr, + menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action); /* HACK */ diff --git a/menu/menu_input.c b/menu/menu_input.c index 3c34763573..fc6740c61b 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -1029,7 +1029,8 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs, if (menu_input->pointer.oldpressed[0]) { if (!menu_input->pointer.dragging) - ret = menu_driver_pointer_tap(cbs, entry, action); + ret = menu_driver_pointer_tap(menu_input->pointer.start_x, + menu_input->pointer.start_y, menu_input->pointer.ptr, cbs, entry, action); menu_input->pointer.oldpressed[0] = false; menu_input->pointer.start_x = 0;