mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Merge pull request #11389 from jdgleaver/keymap-fix
(udev/linuxraw/wayland) Fix return key keyboard input
This commit is contained in:
commit
d7a321fdbb
@ -72,24 +72,38 @@ static void keyboard_handle_key(void *data,
|
|||||||
{
|
{
|
||||||
int value = 1;
|
int value = 1;
|
||||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
||||||
|
uint32_t keysym = key;
|
||||||
|
|
||||||
|
/* Handle 'duplicate' inputs that correspond
|
||||||
|
* to the same RETROK_* key */
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case KEY_OK:
|
||||||
|
case KEY_SELECT:
|
||||||
|
keysym = KEY_ENTER;
|
||||||
|
case KEY_EXIT:
|
||||||
|
keysym = KEY_CLEAR;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
|
if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
|
||||||
{
|
{
|
||||||
BIT_SET(wl->input.key_state, key);
|
BIT_SET(wl->input.key_state, keysym);
|
||||||
value = 1;
|
value = 1;
|
||||||
}
|
}
|
||||||
else if (state == WL_KEYBOARD_KEY_STATE_RELEASED)
|
else if (state == WL_KEYBOARD_KEY_STATE_RELEASED)
|
||||||
{
|
{
|
||||||
BIT_CLEAR(wl->input.key_state, key);
|
BIT_CLEAR(wl->input.key_state, keysym);
|
||||||
value = 0;
|
value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_XKBCOMMON
|
#ifdef HAVE_XKBCOMMON
|
||||||
if (handle_xkb(key, value) == 0)
|
if (handle_xkb(keysym, value) == 0)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
input_keyboard_event(value,
|
input_keyboard_event(value,
|
||||||
input_keymaps_translate_keysym_to_rk(key),
|
input_keymaps_translate_keysym_to_rk(keysym),
|
||||||
0, 0, RETRO_DEVICE_KEYBOARD);
|
0, 0, RETRO_DEVICE_KEYBOARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,14 +155,22 @@ int handle_xkb(int code, int value);
|
|||||||
static unsigned input_unify_ev_key_code(unsigned code)
|
static unsigned input_unify_ev_key_code(unsigned code)
|
||||||
{
|
{
|
||||||
/* input_keymaps_translate_keysym_to_rk does not support the case
|
/* input_keymaps_translate_keysym_to_rk does not support the case
|
||||||
where multiple keysyms translate to the same RETROK_* code,
|
* where multiple keysyms translate to the same RETROK_* code,
|
||||||
so unify remote control keysyms to keyboard keysyms here. */
|
* so unify remote control keysyms to keyboard keysyms here.
|
||||||
|
*
|
||||||
|
* Addendum: The rarch_keysym_lut lookup table also becomes
|
||||||
|
* unusable if more than one keysym translates to the same
|
||||||
|
* RETROK_* code, so certain keys must be left unmapped in
|
||||||
|
* rarch_key_map_linux and instead be handled here */
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case KEY_OK:
|
case KEY_OK:
|
||||||
|
case KEY_SELECT:
|
||||||
return KEY_ENTER;
|
return KEY_ENTER;
|
||||||
case KEY_BACK:
|
case KEY_BACK:
|
||||||
return KEY_BACKSPACE;
|
return KEY_BACKSPACE;
|
||||||
|
case KEY_EXIT:
|
||||||
|
return KEY_CLEAR;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -552,7 +552,7 @@ static void *udev_joypad_init(void *data)
|
|||||||
|
|
||||||
udev_joypad_fd = udev_new();
|
udev_joypad_fd = udev_new();
|
||||||
if (!udev_joypad_fd)
|
if (!udev_joypad_fd)
|
||||||
return false;
|
return NULL;
|
||||||
|
|
||||||
udev_joypad_mon = udev_monitor_new_from_netlink(udev_joypad_fd, "udev");
|
udev_joypad_mon = udev_monitor_new_from_netlink(udev_joypad_fd, "udev");
|
||||||
if (udev_joypad_mon)
|
if (udev_joypad_mon)
|
||||||
|
@ -981,14 +981,18 @@ const struct rarch_key_map rarch_key_map_x11[] = {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__) || defined(HAVE_WAYLAND)
|
#if defined(__linux__) || defined(HAVE_WAYLAND)
|
||||||
|
/* Note: Only one input can be mapped to each
|
||||||
|
* RETROK_* key. If several physical inputs
|
||||||
|
* correspond to the same key, these inputs
|
||||||
|
* must be merged at the input driver level */
|
||||||
const struct rarch_key_map rarch_key_map_linux[] = {
|
const struct rarch_key_map rarch_key_map_linux[] = {
|
||||||
{ KEY_BACKSPACE, RETROK_BACKSPACE },
|
{ KEY_BACKSPACE, RETROK_BACKSPACE },
|
||||||
{ KEY_TAB, RETROK_TAB },
|
{ KEY_TAB, RETROK_TAB },
|
||||||
{ KEY_CLEAR, RETROK_CLEAR },
|
{ KEY_CLEAR, RETROK_CLEAR },
|
||||||
{ KEY_EXIT, RETROK_CLEAR },
|
/* { KEY_EXIT, RETROK_CLEAR }, */ /* Duplicate - Skip */
|
||||||
{ KEY_ENTER, RETROK_RETURN },
|
{ KEY_ENTER, RETROK_RETURN },
|
||||||
{ KEY_OK, RETROK_RETURN },
|
/* { KEY_OK, RETROK_RETURN }, */ /* Duplicate - Skip */
|
||||||
{ KEY_SELECT, RETROK_RETURN },
|
/* { KEY_SELECT, RETROK_RETURN }, */ /* Duplicate - Skip */
|
||||||
{ KEY_PAUSE, RETROK_PAUSE },
|
{ KEY_PAUSE, RETROK_PAUSE },
|
||||||
{ KEY_ESC, RETROK_ESCAPE },
|
{ KEY_ESC, RETROK_ESCAPE },
|
||||||
{ KEY_SPACE, RETROK_SPACE },
|
{ KEY_SPACE, RETROK_SPACE },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user