From 5287e46e572489c586c2ef431d3100499cf08681 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sun, 1 Nov 2015 20:35:43 +0100 Subject: [PATCH] =?UTF-8?q?Revert=20"(Menu)=20Make=20the=20mouse=20left=20?= =?UTF-8?q?click=20and=20the=20pointer=20tap=20use=20the=20same=20cod?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- menu/drivers/glui.c | 18 ++++++++++-------- menu/drivers/rgui.c | 12 ++++++------ menu/drivers/xmb.c | 12 ++++++------ menu/menu_driver.c | 6 +++--- menu/menu_driver.h | 8 ++++---- menu/menu_input.c | 28 ++++++++++++++++------------ 6 files changed, 45 insertions(+), 39 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 981361974b..6de160b05a 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -1426,12 +1426,13 @@ static size_t glui_list_get_selection(void *data) return glui->categories.selection_ptr; } -static int glui_pointer_tap(unsigned x, unsigned y, unsigned ptr, - menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action) +static int glui_pointer_tap(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); @@ -1445,19 +1446,20 @@ static int glui_pointer_tap(unsigned x, unsigned y, unsigned ptr, menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height); - if (y < header_height) + 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 (y > height - glui->tabs_height) + else if ((unsigned)menu_input->pointer.start_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 (x >= start && x < start + tab_width) + if ((unsigned)menu_input->pointer.start_x >= start && + (unsigned)menu_input->pointer.start_x < start + tab_width) { glui->categories.selection_ptr = i; @@ -1469,12 +1471,12 @@ static int glui_pointer_tap(unsigned x, unsigned y, unsigned ptr, } } } - else if (ptr <= (menu_entries_get_size() - 1)) + else if (menu_input->pointer.ptr <= (menu_entries_get_size() - 1)) { - if (ptr == selection && cbs && cbs->action_select) + if (menu_input->pointer.ptr == selection && cbs && cbs->action_select) return menu_entry_action(entry, selection, MENU_ACTION_SELECT); - idx = ptr; + idx = menu_input->pointer.ptr; menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll); diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 450a5ccd9b..4349579915 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -840,8 +840,8 @@ static int rgui_environ(menu_environ_cb_t type, void *data) return 0; } -static int rgui_pointer_tap(unsigned x, unsigned y, unsigned ptr, - menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action) +static int rgui_pointer_tap(menu_file_list_cbs_t *cbs, + menu_entry_t *entry, unsigned action) { size_t selection, idx; unsigned header_height; @@ -851,17 +851,17 @@ static int rgui_pointer_tap(unsigned x, unsigned y, unsigned ptr, menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height); - if (y < header_height) + 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 (ptr <= (menu_entries_get_size() - 1)) + else if (menu_input->pointer.ptr <= (menu_entries_get_size() - 1)) { - if (ptr == selection && cbs && cbs->action_select) + if (menu_input->pointer.ptr == selection && cbs && cbs->action_select) return menu_entry_action(entry, selection, MENU_ACTION_SELECT); - idx = ptr; + idx = menu_input->pointer.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 0ff122f20c..0df1109cdb 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2723,8 +2723,8 @@ static bool xmb_menu_init_list(void *data) return true; } -static int xmb_pointer_tap(unsigned x, unsigned y, unsigned ptr, - menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action) +static int xmb_pointer_tap(menu_file_list_cbs_t *cbs, + menu_entry_t *entry, unsigned action) { size_t selection, idx; unsigned header_height; @@ -2734,17 +2734,17 @@ static int xmb_pointer_tap(unsigned x, unsigned y, unsigned ptr, menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height); - if (y < header_height) + 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 (ptr <= (menu_entries_get_size() - 1)) + else if (menu_input->pointer.ptr <= (menu_entries_get_size() - 1)) { - if (ptr == selection && cbs && cbs->action_select) + if (menu_input->pointer.ptr == selection && cbs && cbs->action_select) return menu_entry_action(entry, selection, MENU_ACTION_SELECT); - idx = ptr; + idx = menu_input->pointer.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 e12851b2ff..d47a993c8d 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -393,14 +393,14 @@ bool menu_environment_cb(menu_environ_cb_t type, void *data) return false; } -int menu_driver_pointer_tap(unsigned x, unsigned y, unsigned ptr, - menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action) +int menu_driver_pointer_tap(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(x, y, ptr, cbs, entry, action); + ret = driver->pointer_tap(cbs, entry, action); return ret; } diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 3b73414b0a..7eaac07ce9 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -142,8 +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)(unsigned x, unsigned y, unsigned ptr, - menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action); + int (*pointer_tap)(menu_file_list_cbs_t *cbs, + menu_entry_t *entry, unsigned action); } menu_ctx_driver_t; extern menu_ctx_driver_t menu_ctx_rmenu; @@ -230,8 +230,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(unsigned x, unsigned y, unsigned ptr, - menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action); +int menu_driver_pointer_tap(menu_file_list_cbs_t *cbs, + menu_entry_t *entry, unsigned action); /* HACK */ extern unsigned int rdb_entry_start_game_selection_ptr; diff --git a/menu/menu_input.c b/menu/menu_input.c index 113b10bd1b..3c34763573 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -790,9 +790,8 @@ static int menu_input_pointer(unsigned *action) static int menu_input_mouse_frame( menu_file_list_cbs_t *cbs, menu_entry_t *entry, - uint64_t input_mouse, unsigned action) + uint64_t input_mouse) { - int ret; size_t selection; menu_input_t *menu_input = menu_input_get_ptr(); @@ -800,8 +799,16 @@ static int menu_input_mouse_frame( if (BIT64_GET(input_mouse, MOUSE_ACTION_BUTTON_L)) { - ret = menu_driver_pointer_tap(menu_input->mouse.x, menu_input->mouse.y, - menu_input->mouse.ptr, cbs, entry, action); + if (BIT64_GET(input_mouse, MOUSE_ACTION_BUTTON_L_TOGGLE)) + return menu_entry_action(entry, selection, MENU_ACTION_SELECT); + + if (BIT64_GET(input_mouse, MOUSE_ACTION_BUTTON_L_SET_NAVIGATION)) + { + size_t idx = menu_input->mouse.ptr; + bool scroll = false; + menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx); + menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll); + } } if (BIT64_GET(input_mouse, MOUSE_ACTION_BUTTON_R)) @@ -822,7 +829,7 @@ static int menu_input_mouse_frame( menu_navigation_ctl(MENU_NAVIGATION_CTL_DECREMENT, &decrement_by); } - return ret; + return 0; } static int menu_input_mouse_post_iterate(uint64_t *input_mouse, @@ -1022,9 +1029,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) - ret = menu_driver_pointer_tap(menu_input->pointer.start_x, - menu_input->pointer.start_y, menu_input->pointer.ptr, - cbs, entry, action); + ret = menu_driver_pointer_tap(cbs, entry, action); menu_input->pointer.oldpressed[0] = false; menu_input->pointer.start_x = 0; @@ -1070,10 +1075,9 @@ void menu_input_post_iterate(int *ret, unsigned action) menu_entry_get(&entry, 0, selection, NULL, false); if (settings->menu.mouse.enable) - { - *ret = menu_input_mouse_post_iterate(&menu_input->mouse.state, cbs, action); - *ret |= menu_input_mouse_frame(cbs, &entry, menu_input->mouse.state, action); - } + *ret = menu_input_mouse_post_iterate (&menu_input->mouse.state, cbs, action); + + *ret = menu_input_mouse_frame(cbs, &entry, menu_input->mouse.state); if (settings->menu.pointer.enable) *ret |= menu_input_pointer_post_iterate(cbs, &entry, action);