mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 06:32:48 +00:00
commit
a07cfd4915
@ -1224,12 +1224,56 @@ static int glui_environ(menu_environ_cb_t type, void *data)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void glui_preswitch_tabs(unsigned action)
|
||||||
|
{
|
||||||
|
glui_handle_t *glui = NULL;
|
||||||
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
|
|
||||||
|
if (!menu)
|
||||||
|
return;
|
||||||
|
|
||||||
|
glui = (glui_handle_t*)menu->userdata;
|
||||||
|
|
||||||
|
if (!glui)
|
||||||
|
return;
|
||||||
|
|
||||||
|
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
||||||
|
size_t stack_size = menu_stack->size;
|
||||||
|
|
||||||
|
if (menu_stack->list[stack_size - 1].label)
|
||||||
|
free(menu_stack->list[stack_size - 1].label);
|
||||||
|
menu_stack->list[stack_size - 1].label = NULL;
|
||||||
|
|
||||||
|
switch (glui->categories.selection_ptr)
|
||||||
|
{
|
||||||
|
case GLUI_SYSTEM_TAB_MAIN:
|
||||||
|
menu_stack->list[stack_size - 1].label =
|
||||||
|
strdup(menu_hash_to_str(MENU_VALUE_MAIN_MENU));
|
||||||
|
menu_stack->list[stack_size - 1].type =
|
||||||
|
MENU_SETTINGS;
|
||||||
|
break;
|
||||||
|
case GLUI_SYSTEM_TAB_PLAYLISTS:
|
||||||
|
menu_stack->list[stack_size - 1].label =
|
||||||
|
strdup(menu_hash_to_str(MENU_VALUE_PLAYLISTS_TAB));
|
||||||
|
menu_stack->list[stack_size - 1].label =
|
||||||
|
strdup(menu_hash_to_str(MENU_VALUE_PLAYLISTS_TAB));
|
||||||
|
menu_stack->list[stack_size - 1].type =
|
||||||
|
MENU_PLAYLISTS_TAB;
|
||||||
|
break;
|
||||||
|
case GLUI_SYSTEM_TAB_SETTINGS:
|
||||||
|
menu_stack->list[stack_size - 1].label =
|
||||||
|
strdup(menu_hash_to_str(MENU_VALUE_SETTINGS_TAB));
|
||||||
|
menu_stack->list[stack_size - 1].type =
|
||||||
|
MENU_SETTINGS;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void glui_list_cache(menu_list_type_t type, unsigned action)
|
static void glui_list_cache(menu_list_type_t type, unsigned action)
|
||||||
{
|
{
|
||||||
size_t stack_size, list_size;
|
size_t stack_size, list_size;
|
||||||
glui_handle_t *glui = NULL;
|
glui_handle_t *glui = NULL;
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
|
||||||
|
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return;
|
return;
|
||||||
@ -1270,35 +1314,7 @@ static void glui_list_cache(menu_list_type_t type, unsigned action)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
stack_size = menu_stack->size;
|
glui_preswitch_tabs(action);
|
||||||
|
|
||||||
if (menu_stack->list[stack_size - 1].label)
|
|
||||||
free(menu_stack->list[stack_size - 1].label);
|
|
||||||
menu_stack->list[stack_size - 1].label = NULL;
|
|
||||||
|
|
||||||
switch (glui->categories.selection_ptr)
|
|
||||||
{
|
|
||||||
case GLUI_SYSTEM_TAB_MAIN:
|
|
||||||
menu_stack->list[stack_size - 1].label =
|
|
||||||
strdup(menu_hash_to_str(MENU_VALUE_MAIN_MENU));
|
|
||||||
menu_stack->list[stack_size - 1].type =
|
|
||||||
MENU_SETTINGS;
|
|
||||||
break;
|
|
||||||
case GLUI_SYSTEM_TAB_PLAYLISTS:
|
|
||||||
menu_stack->list[stack_size - 1].label =
|
|
||||||
strdup(menu_hash_to_str(MENU_VALUE_PLAYLISTS_TAB));
|
|
||||||
menu_stack->list[stack_size - 1].label =
|
|
||||||
strdup(menu_hash_to_str(MENU_VALUE_PLAYLISTS_TAB));
|
|
||||||
menu_stack->list[stack_size - 1].type =
|
|
||||||
MENU_PLAYLISTS_TAB;
|
|
||||||
break;
|
|
||||||
case GLUI_SYSTEM_TAB_SETTINGS:
|
|
||||||
menu_stack->list[stack_size - 1].label =
|
|
||||||
strdup(menu_hash_to_str(MENU_VALUE_SETTINGS_TAB));
|
|
||||||
menu_stack->list[stack_size - 1].type =
|
|
||||||
MENU_SETTINGS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -1409,6 +1425,65 @@ static size_t glui_list_get_selection(void *data)
|
|||||||
return glui->categories.selection_ptr;
|
return glui->categories.selection_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||||
|
|
||||||
|
if (!glui)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
video_driver_get_size(&width, &height);
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
glui->categories.selection_ptr = i;
|
||||||
|
|
||||||
|
glui_preswitch_tabs(action);
|
||||||
|
|
||||||
|
if (cbs && cbs->action_content_list_switch)
|
||||||
|
return cbs->action_content_list_switch(selection_buf, menu_stack,
|
||||||
|
"", "", 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (menu_input->pointer.ptr <= (menu_entries_get_size() - 1))
|
||||||
|
{
|
||||||
|
if (menu_input->pointer.ptr == selection && cbs && cbs->action_select)
|
||||||
|
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
||||||
|
|
||||||
|
idx = menu_input->pointer.ptr;
|
||||||
|
|
||||||
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
||||||
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
menu_ctx_driver_t menu_ctx_glui = {
|
menu_ctx_driver_t menu_ctx_glui = {
|
||||||
NULL,
|
NULL,
|
||||||
glui_get_message,
|
glui_get_message,
|
||||||
@ -1443,4 +1518,5 @@ menu_ctx_driver_t menu_ctx_glui = {
|
|||||||
"glui",
|
"glui",
|
||||||
MENU_VIDEO_DRIVER_OPENGL,
|
MENU_VIDEO_DRIVER_OPENGL,
|
||||||
glui_environ,
|
glui_environ,
|
||||||
|
glui_pointer_tap,
|
||||||
};
|
};
|
||||||
|
@ -57,4 +57,5 @@ menu_ctx_driver_t menu_ctx_null = {
|
|||||||
"null",
|
"null",
|
||||||
MENU_VIDEO_DRIVER_GENERIC,
|
MENU_VIDEO_DRIVER_GENERIC,
|
||||||
NULL,
|
NULL,
|
||||||
|
NULL,
|
||||||
};
|
};
|
||||||
|
@ -840,6 +840,36 @@ static int rgui_environ(menu_environ_cb_t type, void *data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int rgui_pointer_tap(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)
|
||||||
|
{
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
if (menu_input->pointer.ptr == selection && cbs && cbs->action_select)
|
||||||
|
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
||||||
|
|
||||||
|
idx = menu_input->pointer.ptr;
|
||||||
|
|
||||||
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
||||||
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
menu_ctx_driver_t menu_ctx_rgui = {
|
menu_ctx_driver_t menu_ctx_rgui = {
|
||||||
rgui_set_texture,
|
rgui_set_texture,
|
||||||
rgui_set_message,
|
rgui_set_message,
|
||||||
@ -874,4 +904,5 @@ menu_ctx_driver_t menu_ctx_rgui = {
|
|||||||
"rgui",
|
"rgui",
|
||||||
MENU_VIDEO_DRIVER_GENERIC,
|
MENU_VIDEO_DRIVER_GENERIC,
|
||||||
rgui_environ,
|
rgui_environ,
|
||||||
|
rgui_pointer_tap,
|
||||||
};
|
};
|
||||||
|
@ -359,4 +359,5 @@ menu_ctx_driver_t menu_ctx_rmenu = {
|
|||||||
"rmenu",
|
"rmenu",
|
||||||
MENU_VIDEO_DRIVER_DIRECT3D,
|
MENU_VIDEO_DRIVER_DIRECT3D,
|
||||||
rmenu_environ,
|
rmenu_environ,
|
||||||
|
NULL,
|
||||||
};
|
};
|
||||||
|
@ -725,4 +725,5 @@ menu_ctx_driver_t menu_ctx_rmenu_xui = {
|
|||||||
"rmenu_xui",
|
"rmenu_xui",
|
||||||
MENU_VIDEO_DRIVER_DIRECT3D,
|
MENU_VIDEO_DRIVER_DIRECT3D,
|
||||||
rmenu_xui_environ,
|
rmenu_xui_environ,
|
||||||
|
NULL,
|
||||||
};
|
};
|
||||||
|
@ -2723,6 +2723,36 @@ static bool xmb_menu_init_list(void *data)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int xmb_pointer_tap(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)
|
||||||
|
{
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
if (menu_input->pointer.ptr == selection && cbs && cbs->action_select)
|
||||||
|
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
||||||
|
|
||||||
|
idx = menu_input->pointer.ptr;
|
||||||
|
|
||||||
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
||||||
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
menu_ctx_driver_t menu_ctx_xmb = {
|
menu_ctx_driver_t menu_ctx_xmb = {
|
||||||
NULL,
|
NULL,
|
||||||
xmb_render_messagebox_internal,
|
xmb_render_messagebox_internal,
|
||||||
@ -2757,4 +2787,5 @@ menu_ctx_driver_t menu_ctx_xmb = {
|
|||||||
"xmb",
|
"xmb",
|
||||||
MENU_VIDEO_DRIVER_OPENGL,
|
MENU_VIDEO_DRIVER_OPENGL,
|
||||||
xmb_environ,
|
xmb_environ,
|
||||||
|
xmb_pointer_tap,
|
||||||
};
|
};
|
||||||
|
@ -1388,4 +1388,5 @@ menu_ctx_driver_t menu_ctx_zarch = {
|
|||||||
"zarch",
|
"zarch",
|
||||||
MENU_VIDEO_DRIVER_OPENGL,
|
MENU_VIDEO_DRIVER_OPENGL,
|
||||||
NULL,
|
NULL,
|
||||||
|
NULL,
|
||||||
};
|
};
|
||||||
|
@ -379,7 +379,6 @@ bool menu_driver_load_image(void *data, menu_image_type_t type)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool menu_environment_cb(menu_environ_cb_t type, void *data)
|
bool menu_environment_cb(menu_environ_cb_t type, void *data)
|
||||||
{
|
{
|
||||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||||
@ -393,3 +392,15 @@ bool menu_environment_cb(menu_environ_cb_t type, void *data)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(cbs, entry, action);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -142,6 +142,8 @@ typedef struct menu_ctx_driver
|
|||||||
const char *ident;
|
const char *ident;
|
||||||
menu_video_driver_type_t type;
|
menu_video_driver_type_t type;
|
||||||
int (*environ_cb)(menu_environ_cb_t type, void *data);
|
int (*environ_cb)(menu_environ_cb_t type, void *data);
|
||||||
|
int (*pointer_tap)(menu_file_list_cbs_t *cbs,
|
||||||
|
menu_entry_t *entry, unsigned action);
|
||||||
} menu_ctx_driver_t;
|
} menu_ctx_driver_t;
|
||||||
|
|
||||||
extern menu_ctx_driver_t menu_ctx_rmenu;
|
extern menu_ctx_driver_t menu_ctx_rmenu;
|
||||||
@ -228,6 +230,9 @@ int menu_driver_bind_init(menu_file_list_cbs_t *cbs,
|
|||||||
const char *elem0, const char *elem1,
|
const char *elem0, const char *elem1,
|
||||||
uint32_t label_hash, uint32_t menu_label_hash);
|
uint32_t label_hash, uint32_t menu_label_hash);
|
||||||
|
|
||||||
|
int menu_driver_pointer_tap(menu_file_list_cbs_t *cbs,
|
||||||
|
menu_entry_t *entry, unsigned action);
|
||||||
|
|
||||||
/* HACK */
|
/* HACK */
|
||||||
extern unsigned int rdb_entry_start_game_selection_ptr;
|
extern unsigned int rdb_entry_start_game_selection_ptr;
|
||||||
|
|
||||||
|
@ -40,108 +40,6 @@
|
|||||||
#include "../input/input_remapping.h"
|
#include "../input/input_remapping.h"
|
||||||
#include "../input/input_common.h"
|
#include "../input/input_common.h"
|
||||||
|
|
||||||
#define MENU_MAX_BUTTONS 219
|
|
||||||
#define MENU_MAX_AXES 32
|
|
||||||
#define MENU_MAX_HATS 4
|
|
||||||
|
|
||||||
unsigned bind_port;
|
|
||||||
|
|
||||||
struct menu_bind_state_port
|
|
||||||
{
|
|
||||||
bool buttons[MENU_MAX_BUTTONS];
|
|
||||||
int16_t axes[MENU_MAX_AXES];
|
|
||||||
uint16_t hats[MENU_MAX_HATS];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct menu_bind_axis_state
|
|
||||||
{
|
|
||||||
/* Default axis state. */
|
|
||||||
int16_t rested_axes[MENU_MAX_AXES];
|
|
||||||
/* Locked axis state. If we configured an axis,
|
|
||||||
* avoid having the same axis state trigger something again right away. */
|
|
||||||
int16_t locked_axes[MENU_MAX_AXES];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct menu_bind_state
|
|
||||||
{
|
|
||||||
struct retro_keybind *target;
|
|
||||||
/* For keyboard binding. */
|
|
||||||
int64_t timeout_end;
|
|
||||||
unsigned begin;
|
|
||||||
unsigned last;
|
|
||||||
unsigned user;
|
|
||||||
struct menu_bind_state_port state[MAX_USERS];
|
|
||||||
struct menu_bind_axis_state axis_state[MAX_USERS];
|
|
||||||
bool skip;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct menu_input_mouse
|
|
||||||
{
|
|
||||||
int16_t x;
|
|
||||||
int16_t y;
|
|
||||||
bool left;
|
|
||||||
bool right;
|
|
||||||
bool oldleft;
|
|
||||||
bool oldright;
|
|
||||||
bool wheelup;
|
|
||||||
bool wheeldown;
|
|
||||||
bool hwheelup;
|
|
||||||
bool hwheeldown;
|
|
||||||
bool scrollup;
|
|
||||||
bool scrolldown;
|
|
||||||
unsigned ptr;
|
|
||||||
uint64_t state;
|
|
||||||
} menu_input_mouse_t;
|
|
||||||
|
|
||||||
typedef struct menu_input
|
|
||||||
{
|
|
||||||
struct menu_bind_state binds;
|
|
||||||
|
|
||||||
bool bind_mode_keyboard;
|
|
||||||
|
|
||||||
uint64_t devices_mask;
|
|
||||||
|
|
||||||
menu_input_mouse_t mouse;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
int16_t x;
|
|
||||||
int16_t y;
|
|
||||||
int16_t dx;
|
|
||||||
int16_t dy;
|
|
||||||
int16_t old_x;
|
|
||||||
int16_t old_y;
|
|
||||||
int16_t start_x;
|
|
||||||
int16_t start_y;
|
|
||||||
float accel;
|
|
||||||
float accel0;
|
|
||||||
float accel1;
|
|
||||||
bool pressed[2];
|
|
||||||
bool oldpressed[2];
|
|
||||||
bool dragging;
|
|
||||||
bool back;
|
|
||||||
bool oldback;
|
|
||||||
unsigned ptr;
|
|
||||||
} pointer;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
const char **buffer;
|
|
||||||
const char *label;
|
|
||||||
const char *label_setting;
|
|
||||||
bool display;
|
|
||||||
unsigned type;
|
|
||||||
unsigned idx;
|
|
||||||
} keyboard;
|
|
||||||
|
|
||||||
/* Used for key repeat */
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
float timer;
|
|
||||||
float count;
|
|
||||||
} delay;
|
|
||||||
} menu_input_t;
|
|
||||||
|
|
||||||
static menu_input_t menu_input_state;
|
static menu_input_t menu_input_state;
|
||||||
|
|
||||||
void menu_input_free(void)
|
void menu_input_free(void)
|
||||||
@ -149,7 +47,7 @@ void menu_input_free(void)
|
|||||||
memset(&menu_input_state, 0, sizeof(menu_input_t));
|
memset(&menu_input_state, 0, sizeof(menu_input_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
static menu_input_t *menu_input_get_ptr(void)
|
menu_input_t *menu_input_get_ptr(void)
|
||||||
{
|
{
|
||||||
return &menu_input_state;
|
return &menu_input_state;
|
||||||
}
|
}
|
||||||
@ -1012,26 +910,6 @@ static int menu_input_mouse_post_iterate(uint64_t *input_mouse,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pointer_tap(menu_file_list_cbs_t *cbs,
|
|
||||||
menu_entry_t *entry, unsigned action)
|
|
||||||
{
|
|
||||||
size_t selection, idx;
|
|
||||||
bool scroll = false;
|
|
||||||
menu_input_t *menu_input = menu_input_get_ptr();
|
|
||||||
|
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
|
|
||||||
|
|
||||||
if (menu_input->pointer.ptr == selection && cbs && cbs->action_select)
|
|
||||||
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
|
||||||
|
|
||||||
idx = menu_input->pointer.ptr;
|
|
||||||
|
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t menu_input_pointer_state(enum menu_input_pointer_state state)
|
int16_t menu_input_pointer_state(enum menu_input_pointer_state state)
|
||||||
{
|
{
|
||||||
menu_input_t *menu = menu_input_get_ptr();
|
menu_input_t *menu = menu_input_get_ptr();
|
||||||
@ -1151,18 +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.oldpressed[0])
|
||||||
{
|
{
|
||||||
if (!menu_input->pointer.dragging)
|
if (!menu_input->pointer.dragging)
|
||||||
{
|
ret = menu_driver_pointer_tap(cbs, entry, action);
|
||||||
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 (menu_input->pointer.ptr <= (menu_entries_get_size() - 1))
|
|
||||||
{
|
|
||||||
menu_input->pointer.oldpressed[0] = false;
|
|
||||||
ret = pointer_tap(cbs, entry, action);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
menu_input->pointer.oldpressed[0] = false;
|
menu_input->pointer.oldpressed[0] = false;
|
||||||
menu_input->pointer.start_x = 0;
|
menu_input->pointer.start_x = 0;
|
||||||
|
@ -105,6 +105,110 @@ enum menu_input_bind_mode
|
|||||||
MENU_INPUT_BIND_ALL
|
MENU_INPUT_BIND_ALL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define MENU_MAX_BUTTONS 219
|
||||||
|
#define MENU_MAX_AXES 32
|
||||||
|
#define MENU_MAX_HATS 4
|
||||||
|
|
||||||
|
unsigned bind_port;
|
||||||
|
|
||||||
|
struct menu_bind_state_port
|
||||||
|
{
|
||||||
|
bool buttons[MENU_MAX_BUTTONS];
|
||||||
|
int16_t axes[MENU_MAX_AXES];
|
||||||
|
uint16_t hats[MENU_MAX_HATS];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct menu_bind_axis_state
|
||||||
|
{
|
||||||
|
/* Default axis state. */
|
||||||
|
int16_t rested_axes[MENU_MAX_AXES];
|
||||||
|
/* Locked axis state. If we configured an axis,
|
||||||
|
* avoid having the same axis state trigger something again right away. */
|
||||||
|
int16_t locked_axes[MENU_MAX_AXES];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct menu_bind_state
|
||||||
|
{
|
||||||
|
struct retro_keybind *target;
|
||||||
|
/* For keyboard binding. */
|
||||||
|
int64_t timeout_end;
|
||||||
|
unsigned begin;
|
||||||
|
unsigned last;
|
||||||
|
unsigned user;
|
||||||
|
struct menu_bind_state_port state[MAX_USERS];
|
||||||
|
struct menu_bind_axis_state axis_state[MAX_USERS];
|
||||||
|
bool skip;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct menu_input_mouse
|
||||||
|
{
|
||||||
|
int16_t x;
|
||||||
|
int16_t y;
|
||||||
|
bool left;
|
||||||
|
bool right;
|
||||||
|
bool oldleft;
|
||||||
|
bool oldright;
|
||||||
|
bool wheelup;
|
||||||
|
bool wheeldown;
|
||||||
|
bool hwheelup;
|
||||||
|
bool hwheeldown;
|
||||||
|
bool scrollup;
|
||||||
|
bool scrolldown;
|
||||||
|
unsigned ptr;
|
||||||
|
uint64_t state;
|
||||||
|
} menu_input_mouse_t;
|
||||||
|
|
||||||
|
typedef struct menu_input
|
||||||
|
{
|
||||||
|
struct menu_bind_state binds;
|
||||||
|
|
||||||
|
bool bind_mode_keyboard;
|
||||||
|
|
||||||
|
uint64_t devices_mask;
|
||||||
|
|
||||||
|
menu_input_mouse_t mouse;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int16_t x;
|
||||||
|
int16_t y;
|
||||||
|
int16_t dx;
|
||||||
|
int16_t dy;
|
||||||
|
int16_t old_x;
|
||||||
|
int16_t old_y;
|
||||||
|
int16_t start_x;
|
||||||
|
int16_t start_y;
|
||||||
|
float accel;
|
||||||
|
float accel0;
|
||||||
|
float accel1;
|
||||||
|
bool pressed[2];
|
||||||
|
bool oldpressed[2];
|
||||||
|
bool dragging;
|
||||||
|
bool back;
|
||||||
|
bool oldback;
|
||||||
|
unsigned ptr;
|
||||||
|
} pointer;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const char **buffer;
|
||||||
|
const char *label;
|
||||||
|
const char *label_setting;
|
||||||
|
bool display;
|
||||||
|
unsigned type;
|
||||||
|
unsigned idx;
|
||||||
|
} keyboard;
|
||||||
|
|
||||||
|
/* Used for key repeat */
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float timer;
|
||||||
|
float count;
|
||||||
|
} delay;
|
||||||
|
} menu_input_t;
|
||||||
|
|
||||||
|
menu_input_t *menu_input_get_ptr(void);
|
||||||
|
|
||||||
void menu_input_key_event(bool down, unsigned keycode, uint32_t character,
|
void menu_input_key_event(bool down, unsigned keycode, uint32_t character,
|
||||||
uint16_t key_modifiers);
|
uint16_t key_modifiers);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user