diff --git a/menu/cbs/menu_cbs_select.c b/menu/cbs/menu_cbs_select.c index 15c8205bf7..8d31efe823 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -95,7 +95,13 @@ static int action_select_default(const char *path, const char *label, unsigned t } if (action != MENU_ACTION_NOOP) - ret = menu_entry_action(&entry, (unsigned)idx, action); + { + menu_handle_t *menu = NULL; + + menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu); + + ret = menu_entry_action(&entry, menu, (unsigned)idx, action); + } menu_entry_free(&entry); diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 8d4e0deb7b..f21a50afc2 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -2268,7 +2268,8 @@ static size_t materialui_list_get_selection(void *data) /* The pointer or the mouse is pressed down. We use this callback to highlight the entry that has been pressed */ -static int materialui_pointer_down(void *userdata, +static int materialui_pointer_down(void *data, + void *userdata, unsigned x, unsigned y, unsigned ptr, menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action) @@ -2276,22 +2277,16 @@ static int materialui_pointer_down(void *userdata, unsigned width, height; unsigned header_height; size_t entries_end = menu_entries_get_size(); - materialui_handle_t *mui = (materialui_handle_t*)userdata; + materialui_handle_t *mui = (materialui_handle_t*)userdata; if (!mui) return 0; - header_height = menu_display_get_header_height(); + header_height = menu_display_get_header_height(); video_driver_get_size(&width, &height); - if (y < header_height) - { - - } - else if (y > height - mui->tabs_height) - { - - } + if (y < header_height) { } + else if (y > height - mui->tabs_height) { } else if (ptr <= (entries_end - 1)) { size_t ii; @@ -2318,7 +2313,8 @@ static int materialui_pointer_down(void *userdata, If we clicked on the header, we perform a cancel action. If we clicked on the tabs, we switch to a new list. If we clicked on a menu entry, we call the entry action callback. */ -static int materialui_pointer_up(void *userdata, +static int materialui_pointer_up(void *data, + void *userdata, unsigned x, unsigned y, unsigned ptr, menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action) @@ -2326,7 +2322,7 @@ static int materialui_pointer_up(void *userdata, unsigned width, height; unsigned header_height, i; size_t entries_end = menu_entries_get_size(); - materialui_handle_t *mui = (materialui_handle_t*)userdata; + materialui_handle_t *mui = (materialui_handle_t*)userdata; if (!mui) return 0; @@ -2337,7 +2333,7 @@ static int materialui_pointer_up(void *userdata, if (y < header_height) { size_t selection = menu_navigation_get_selection(); - return menu_entry_action(entry, (unsigned)selection, MENU_ACTION_CANCEL); + return menu_entry_action(entry, data, (unsigned)selection, MENU_ACTION_CANCEL); } else if (y > height - mui->tabs_height) { @@ -2376,7 +2372,8 @@ static int materialui_pointer_up(void *userdata, ) { if (ptr == ii && cbs && cbs->action_select) - return menu_entry_action(entry, (unsigned)ii, MENU_ACTION_SELECT); + return menu_entry_action(entry, data, + (unsigned)ii, MENU_ACTION_SELECT); } } } diff --git a/menu/drivers/menu_generic.c b/menu/drivers/menu_generic.c index 3661d5d5e2..4566b79c67 100644 --- a/menu/drivers/menu_generic.c +++ b/menu/drivers/menu_generic.c @@ -229,7 +229,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action) menu_entry_init(&entry); menu_entry_get(&entry, 0, selection, NULL, false); - ret = menu_entry_action(&entry, + ret = menu_entry_action(&entry, menu, (unsigned)selection, (enum menu_action)action); menu_entry_free(&entry); if (ret) diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 16de9c2c43..0c746d7cbd 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -868,6 +868,7 @@ static int rgui_environ(enum menu_environ_cb type, } static int rgui_pointer_tap(void *data, + void *userdata, unsigned x, unsigned y, unsigned ptr, menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action) @@ -877,14 +878,16 @@ static int rgui_pointer_tap(void *data, if (y < header_height) { size_t selection = menu_navigation_get_selection(); - return menu_entry_action(entry, (unsigned)selection, MENU_ACTION_CANCEL); + return menu_entry_action(entry, data, + (unsigned)selection, MENU_ACTION_CANCEL); } else if (ptr <= (menu_entries_get_size() - 1)) { size_t selection = menu_navigation_get_selection(); if (ptr == selection && cbs && cbs->action_select) - return menu_entry_action(entry, (unsigned)selection, MENU_ACTION_SELECT); + return menu_entry_action(entry, data, + (unsigned)selection, MENU_ACTION_SELECT); menu_navigation_set_selection(ptr); menu_driver_navigation_set(false); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 53ca07b3d7..ce2c0ee83b 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -5132,7 +5132,8 @@ error: return false; } -static int xmb_pointer_tap(void *userdata, +static int xmb_pointer_tap(void *data, + void *userdata, unsigned x, unsigned y, unsigned ptr, menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action) @@ -5142,13 +5143,13 @@ static int xmb_pointer_tap(void *userdata, if (y < header_height) { size_t selection = menu_navigation_get_selection(); - return (unsigned)menu_entry_action(entry, (unsigned)selection, MENU_ACTION_CANCEL); + return (unsigned)menu_entry_action(entry, data, (unsigned)selection, MENU_ACTION_CANCEL); } else if (ptr <= (menu_entries_get_size() - 1)) { size_t selection = menu_navigation_get_selection(); if (ptr == selection && cbs && cbs->action_select) - return (unsigned)menu_entry_action(entry, (unsigned)selection, MENU_ACTION_SELECT); + return (unsigned)menu_entry_action(entry, data, (unsigned)selection, MENU_ACTION_SELECT); menu_navigation_set_selection(ptr); menu_driver_navigation_set(false); diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 82b2932143..9e8015c55b 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -2119,7 +2119,8 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) point->retcode = 0; return false; } - point->retcode = menu_driver_ctx->pointer_tap(menu_userdata, + point->retcode = menu_driver_ctx->pointer_tap(menu_driver_data, + menu_userdata, point->x, point->y, point->ptr, point->cbs, point->entry, point->action); } @@ -2132,7 +2133,9 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) point->retcode = 0; return false; } - point->retcode = menu_driver_ctx->pointer_down(menu_userdata, + point->retcode = menu_driver_ctx->pointer_down( + menu_driver_data, + menu_userdata, point->x, point->y, point->ptr, point->cbs, point->entry, point->action); } @@ -2145,7 +2148,9 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) point->retcode = 0; return false; } - point->retcode = menu_driver_ctx->pointer_up(menu_userdata, + point->retcode = menu_driver_ctx->pointer_up( + menu_driver_data, + menu_userdata, point->x, point->y, point->ptr, point->cbs, point->entry, point->action); } diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 412e920478..c9cbc48de9 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -486,7 +486,8 @@ typedef struct menu_ctx_driver bool (*load_image)(void *userdata, void *data, enum menu_image_type type); const char *ident; int (*environ_cb)(enum menu_environ_cb type, void *data, void *userdata); - int (*pointer_tap)(void *data, unsigned x, unsigned y, unsigned ptr, + int (*pointer_tap)(void *data, void *userdata, + unsigned x, unsigned y, unsigned ptr, menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action); void (*update_thumbnail_path)(void *data, unsigned i, char pos); @@ -496,10 +497,12 @@ typedef struct menu_ctx_driver int (*osk_ptr_at_pos)(void *data, int x, int y, unsigned width, unsigned height); void (*update_savestate_thumbnail_path)(void *data, unsigned i); void (*update_savestate_thumbnail_image)(void *data); - int (*pointer_down)(void *data, unsigned x, unsigned y, unsigned ptr, + int (*pointer_down)(void *data, void *userdata, + unsigned x, unsigned y, unsigned ptr, menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action); - int (*pointer_up)(void *data, unsigned x, unsigned y, unsigned ptr, + int (*pointer_up)(void *data, void *userdata, + unsigned x, unsigned y, unsigned ptr, menu_file_list_cbs_t *cbs, menu_entry_t *entry, unsigned action); } menu_ctx_driver_t; diff --git a/menu/menu_input.c b/menu/menu_input.c index 8fdeb4f106..a791ad83d3 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -286,8 +286,14 @@ static int menu_input_mouse_frame( if (BIT64_GET(mouse_state, MENU_MOUSE_ACTION_BUTTON_R)) { - size_t selection = menu_navigation_get_selection(); - menu_entry_action(entry, (unsigned)selection, MENU_ACTION_CANCEL); + size_t selection = menu_navigation_get_selection(); + menu_handle_t *menu = NULL; + + menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu); + + menu_entry_action(entry, menu, + (unsigned)selection, + MENU_ACTION_CANCEL); } if (BIT64_GET(mouse_state, MENU_MOUSE_ACTION_WHEEL_DOWN)) @@ -521,9 +527,15 @@ static int menu_input_pointer_post_iterate( { if (menu_input->pointer.counter > 32) { - size_t selection = menu_navigation_get_selection(); + size_t selection = menu_navigation_get_selection(); + menu_handle_t *menu = NULL; + + menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu); + if (cbs && cbs->action_start) - return menu_entry_action(entry, (unsigned)selection, MENU_ACTION_START); + return menu_entry_action(entry, menu, + (unsigned)selection, + MENU_ACTION_START); } else @@ -552,8 +564,14 @@ static int menu_input_pointer_post_iterate( { if (!pointer_oldback) { - pointer_oldback = true; - menu_entry_action(entry, (unsigned)menu_navigation_get_selection(), MENU_ACTION_CANCEL); + menu_handle_t *menu = NULL; + pointer_oldback = true; + + menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu); + + menu_entry_action(entry, menu, + (unsigned)menu_navigation_get_selection(), + MENU_ACTION_CANCEL); } } diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index c0c28b8fdd..6e6aea9007 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -254,12 +254,15 @@ void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len) void menu_entry_reset(uint32_t i) { + menu_handle_t *menu = NULL; menu_entry_t entry; menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); - menu_entry_action(&entry, i, MENU_ACTION_START); + menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu); + + menu_entry_action(&entry, menu, i, MENU_ACTION_START); } void menu_entry_get_value(menu_entry_t *entry, char *s, size_t len) @@ -408,16 +411,21 @@ bool menu_entry_is_currently_selected(unsigned id) int menu_entry_select(uint32_t i) { menu_entry_t entry; + menu_handle_t *menu = NULL; menu_navigation_set_selection(i); menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, false); - return menu_entry_action(&entry, i, MENU_ACTION_SELECT); + menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu); + + return menu_entry_action(&entry, menu, i, MENU_ACTION_SELECT); } -int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action) +int menu_entry_action(menu_entry_t *entry, + void *data, + unsigned i, enum menu_action action) { int ret = 0; file_list_t *selection_buf = @@ -448,15 +456,9 @@ int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action) break; case MENU_ACTION_OK: - { - menu_handle_t *menu = NULL; - - menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu); - - if (cbs && cbs->action_ok) - ret = cbs->action_ok(menu, entry->path, - entry->label, entry->type, i, entry->entry_idx); - } + if (cbs && cbs->action_ok) + ret = cbs->action_ok(data, entry->path, + entry->label, entry->type, i, entry->entry_idx); break; case MENU_ACTION_START: if (cbs && cbs->action_start) diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index b32ec148ee..94ffb13f8b 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -113,7 +113,8 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, int menu_entry_select(uint32_t i); int menu_entry_action(menu_entry_t *entry, - unsigned i, enum menu_action action); + void *data, + unsigned i, enum menu_action action); void menu_entry_free(menu_entry_t *entry);