This commit is contained in:
twinaphex 2016-02-11 00:47:00 +01:00
parent f17f786234
commit ddf5283ecd
3 changed files with 52 additions and 19 deletions

View File

@ -290,16 +290,6 @@ static void menu_driver_toggle(bool latch)
}
}
int menu_driver_pointer_tap(unsigned x, unsigned y, unsigned ptr,
menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action)
{
if (!menu_driver_ctx || !menu_driver_ctx->pointer_tap)
return 0;
return menu_driver_ctx->pointer_tap(menu_userdata,
x, y, ptr, cbs, entry, action);
}
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
{
static struct retro_system_info menu_driver_system;
@ -826,6 +816,19 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
}
}
return false;
case RARCH_MENU_CTL_POINTER_TAP:
{
menu_ctx_pointer_t *point = (menu_ctx_pointer_t*)data;
if (!menu_driver_ctx || !menu_driver_ctx->pointer_tap)
{
point->retcode = 0;
return false;
}
point->retcode = menu_driver_ctx->pointer_tap(menu_userdata,
point->x, point->y, point->ptr,
point->cbs, point->entry, point->action);
}
break;
default:
case RARCH_MENU_CTL_NONE:
break;

View File

@ -160,7 +160,8 @@ enum rarch_menu_ctl_state
RARCH_MENU_CTL_LIST_PUSH,
RARCH_MENU_CTL_ITERATE,
RARCH_MENU_CTL_ENVIRONMENT,
RARCH_MENU_CTL_DRIVER_DATA_GET
RARCH_MENU_CTL_DRIVER_DATA_GET,
RARCH_MENU_CTL_POINTER_TAP
};
typedef enum
@ -371,6 +372,17 @@ typedef struct menu_ctx_environment
void *data;
} menu_ctx_environment_t;
typedef struct menu_ctx_pointer
{
unsigned x;
unsigned y;
unsigned ptr;
menu_file_list_cbs_t *cbs;
menu_entry_t *entry;
unsigned action;
int retcode;
} menu_ctx_pointer_t;
/**
* menu_driver_find_handle:
* @index : index of driver to get handle to.
@ -412,10 +424,6 @@ 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);
/* HACK */
extern unsigned int rdb_entry_start_game_selection_ptr;

View File

@ -859,8 +859,18 @@ 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);
menu_ctx_pointer_t point;
point.x = menu_input->mouse.x;
point.y = menu_input->mouse.y;
point.ptr = menu_input->mouse.ptr;
point.cbs = cbs;
point.entry = entry;
point.action = action;
menu_driver_ctl(RARCH_MENU_CTL_POINTER_TAP, &point);
ret = point.retcode;
}
if (BIT64_GET(input_mouse, MOUSE_ACTION_BUTTON_R))
@ -1088,8 +1098,20 @@ 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);
{
menu_ctx_pointer_t point;
point.x = menu_input->pointer.start_x;
point.y = menu_input->pointer.start_y;
point.ptr = menu_input->pointer.ptr;
point.cbs = cbs;
point.entry = entry;
point.action = action;
menu_driver_ctl(RARCH_MENU_CTL_POINTER_TAP, &point);
ret = point.retcode;
}
menu_input->pointer.oldpressed[0] = false;
menu_input->pointer.start_x = 0;