diff --git a/input/common/wayland_common.c b/input/common/wayland_common.c index 27c1376fc8..6769e82360 100644 --- a/input/common/wayland_common.c +++ b/input/common/wayland_common.c @@ -72,24 +72,38 @@ static void keyboard_handle_key(void *data, { int value = 1; 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) { - BIT_SET(wl->input.key_state, key); + BIT_SET(wl->input.key_state, keysym); value = 1; } else if (state == WL_KEYBOARD_KEY_STATE_RELEASED) { - BIT_CLEAR(wl->input.key_state, key); + BIT_CLEAR(wl->input.key_state, keysym); value = 0; } #ifdef HAVE_XKBCOMMON - if (handle_xkb(key, value) == 0) + if (handle_xkb(keysym, value) == 0) return; #endif input_keyboard_event(value, - input_keymaps_translate_keysym_to_rk(key), + input_keymaps_translate_keysym_to_rk(keysym), 0, 0, RETRO_DEVICE_KEYBOARD); } diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index 70e14e5bf5..edf9c7bc97 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -155,14 +155,22 @@ int handle_xkb(int code, int value); static unsigned input_unify_ev_key_code(unsigned code) { /* input_keymaps_translate_keysym_to_rk does not support the case - where multiple keysyms translate to the same RETROK_* code, - so unify remote control keysyms to keyboard keysyms here. */ + * where multiple keysyms translate to the same RETROK_* code, + * 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) { case KEY_OK: + case KEY_SELECT: return KEY_ENTER; case KEY_BACK: return KEY_BACKSPACE; + case KEY_EXIT: + return KEY_CLEAR; default: break; } diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c index 711dd805fa..4899aaa578 100644 --- a/input/drivers_joypad/udev_joypad.c +++ b/input/drivers_joypad/udev_joypad.c @@ -552,7 +552,7 @@ static void *udev_joypad_init(void *data) udev_joypad_fd = udev_new(); if (!udev_joypad_fd) - return false; + return NULL; udev_joypad_mon = udev_monitor_new_from_netlink(udev_joypad_fd, "udev"); if (udev_joypad_mon) diff --git a/input/input_keymaps.c b/input/input_keymaps.c index 13c9c7f743..4bf89ee5be 100644 --- a/input/input_keymaps.c +++ b/input/input_keymaps.c @@ -981,14 +981,18 @@ const struct rarch_key_map rarch_key_map_x11[] = { #endif #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[] = { { KEY_BACKSPACE, RETROK_BACKSPACE }, { KEY_TAB, RETROK_TAB }, { KEY_CLEAR, RETROK_CLEAR }, - { KEY_EXIT, RETROK_CLEAR }, + /* { KEY_EXIT, RETROK_CLEAR }, */ /* Duplicate - Skip */ { KEY_ENTER, RETROK_RETURN }, - { KEY_OK, RETROK_RETURN }, - { KEY_SELECT, RETROK_RETURN }, + /* { KEY_OK, RETROK_RETURN }, */ /* Duplicate - Skip */ + /* { KEY_SELECT, RETROK_RETURN }, */ /* Duplicate - Skip */ { KEY_PAUSE, RETROK_PAUSE }, { KEY_ESC, RETROK_ESCAPE }, { KEY_SPACE, RETROK_SPACE },