mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-23 03:10:14 +00:00
(Menu) Separate callbacks for pointer_up and pointer_down
This commit is contained in:
parent
ec395048b6
commit
002928c399
@ -1898,7 +1898,43 @@ static size_t mui_list_get_selection(void *data)
|
||||
return mui->categories.selection_ptr;
|
||||
}
|
||||
|
||||
static int mui_pointer_tap(void *userdata,
|
||||
static int mui_pointer_down(void *userdata,
|
||||
unsigned x, unsigned y,
|
||||
unsigned ptr, menu_file_list_cbs_t *cbs,
|
||||
menu_entry_t *entry, unsigned action)
|
||||
{
|
||||
size_t selection;
|
||||
unsigned width, height;
|
||||
unsigned header_height, i;
|
||||
mui_handle_t *mui = (mui_handle_t*)userdata;
|
||||
|
||||
if (!mui)
|
||||
return 0;
|
||||
|
||||
header_height = menu_display_get_header_height();
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
if (y < header_height)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
else if (y > height - mui->tabs_height)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
else if (ptr <= (menu_entries_get_size() - 1))
|
||||
{
|
||||
size_t idx;
|
||||
bool scroll = false;
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
|
||||
idx = ptr;
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mui_pointer_up(void *userdata,
|
||||
unsigned x, unsigned y,
|
||||
unsigned ptr, menu_file_list_cbs_t *cbs,
|
||||
menu_entry_t *entry, unsigned action)
|
||||
@ -2056,10 +2092,12 @@ menu_ctx_driver_t menu_ctx_mui = {
|
||||
mui_load_image,
|
||||
"glui",
|
||||
mui_environ,
|
||||
mui_pointer_tap,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
mui_osk_ptr_at_pos,
|
||||
NULL,
|
||||
NULL
|
||||
NULL,
|
||||
mui_pointer_down,
|
||||
mui_pointer_up,
|
||||
};
|
||||
|
@ -883,6 +883,32 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
point->cbs, point->entry, point->action);
|
||||
}
|
||||
break;
|
||||
case RARCH_MENU_CTL_POINTER_DOWN:
|
||||
{
|
||||
menu_ctx_pointer_t *point = (menu_ctx_pointer_t*)data;
|
||||
if (!menu_driver_ctx || !menu_driver_ctx->pointer_down)
|
||||
{
|
||||
point->retcode = 0;
|
||||
return false;
|
||||
}
|
||||
point->retcode = menu_driver_ctx->pointer_down(menu_userdata,
|
||||
point->x, point->y, point->ptr,
|
||||
point->cbs, point->entry, point->action);
|
||||
}
|
||||
break;
|
||||
case RARCH_MENU_CTL_POINTER_UP:
|
||||
{
|
||||
menu_ctx_pointer_t *point = (menu_ctx_pointer_t*)data;
|
||||
if (!menu_driver_ctx || !menu_driver_ctx->pointer_up)
|
||||
{
|
||||
point->retcode = 0;
|
||||
return false;
|
||||
}
|
||||
point->retcode = menu_driver_ctx->pointer_up(menu_userdata,
|
||||
point->x, point->y, point->ptr,
|
||||
point->cbs, point->entry, point->action);
|
||||
}
|
||||
break;
|
||||
case RARCH_MENU_CTL_OSK_PTR_AT_POS:
|
||||
{
|
||||
unsigned width = 0;
|
||||
|
@ -137,6 +137,8 @@ enum rarch_menu_ctl_state
|
||||
RARCH_MENU_CTL_ENVIRONMENT,
|
||||
RARCH_MENU_CTL_DRIVER_DATA_GET,
|
||||
RARCH_MENU_CTL_POINTER_TAP,
|
||||
RARCH_MENU_CTL_POINTER_DOWN,
|
||||
RARCH_MENU_CTL_POINTER_UP,
|
||||
RARCH_MENU_CTL_OSK_PTR_AT_POS,
|
||||
RARCH_MENU_CTL_BIND_INIT,
|
||||
RARCH_MENU_CTL_UPDATE_THUMBNAIL_PATH,
|
||||
@ -278,6 +280,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,
|
||||
menu_file_list_cbs_t *cbs,
|
||||
menu_entry_t *entry, unsigned action);
|
||||
int (*pointer_up)(void *data, unsigned x, unsigned y, unsigned ptr,
|
||||
menu_file_list_cbs_t *cbs,
|
||||
menu_entry_t *entry, unsigned action);
|
||||
} menu_ctx_driver_t;
|
||||
|
||||
typedef struct menu_ctx_load_image
|
||||
|
@ -273,6 +273,7 @@ static int menu_input_mouse_frame(
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_driver_ctl(RARCH_MENU_CTL_POINTER_UP, &point);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_POINTER_TAP, &point);
|
||||
ret = point.retcode;
|
||||
}
|
||||
@ -448,6 +449,17 @@ static int menu_input_pointer_post_iterate(
|
||||
pointer_old_x = pointer_x;
|
||||
pointer_old_y = pointer_y;
|
||||
pointer_oldpressed[0] = true;
|
||||
|
||||
menu_ctx_pointer_t point;
|
||||
|
||||
point.x = start_x;
|
||||
point.y = start_y;
|
||||
point.ptr = menu_input->pointer.ptr;
|
||||
point.cbs = cbs;
|
||||
point.entry = entry;
|
||||
point.action = action;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_POINTER_DOWN, &point);
|
||||
}
|
||||
else if (abs(pointer_x - start_x) > (dpi / 10)
|
||||
|| abs(pointer_y - start_y) > (dpi / 10))
|
||||
@ -495,6 +507,7 @@ static int menu_input_pointer_post_iterate(
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_driver_ctl(RARCH_MENU_CTL_POINTER_UP, &point);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_POINTER_TAP, &point);
|
||||
ret = point.retcode;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user