diff --git a/apple/OSX/platform.m b/apple/OSX/platform.m index 689cc4e740..5bd3fca086 100644 --- a/apple/OSX/platform.m +++ b/apple/OSX/platform.m @@ -77,10 +77,12 @@ void apple_rarch_exited(void) mod |= RETROKMOD_NUMLOCK; for (i = 1; i < ch.length; i ++) - apple_input_keyboard_event(event_type == NSKeyDown, 0, [ch characterAtIndex:i], mod); + apple_input_keyboard_event(event_type == NSKeyDown, + 0, [ch characterAtIndex:i], mod, false); } - apple_input_keyboard_event(event_type == NSKeyDown, event.keyCode, character, mod); + apple_input_keyboard_event(event_type == NSKeyDown, + event.keyCode, character, mod, false); } break; case NSFlagsChanged: @@ -90,7 +92,8 @@ void apple_rarch_exited(void) bool down = (new_flags & old_flags) == old_flags; old_flags = new_flags; - apple_input_keyboard_event(down, event.keyCode, 0, event.modifierFlags); + apple_input_keyboard_event(down, event.keyCode, + 0, event.modifierFlags, false); } break; case NSMouseMoved: diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index b94255833a..ae91c3a737 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -176,13 +176,16 @@ enum if (ch && ch.length != 0) { character = [ch characterAtIndex:0]; - apple_input_keyboard_event(event._isKeyDown, (uint32_t)event._keyCode, 0, mod); + apple_input_keyboard_event(event._isKeyDown, + (uint32_t)event._keyCode, 0, mod, false); for (i = 1; i < ch.length; i++) - apple_input_keyboard_event(event._isKeyDown, 0, [ch characterAtIndex:i], mod); + apple_input_keyboard_event(event._isKeyDown, + 0, [ch characterAtIndex:i], mod, false); } - apple_input_keyboard_event(event._isKeyDown, (uint32_t)event._keyCode, character, mod); + apple_input_keyboard_event(event._isKeyDown, + (uint32_t)event._keyCode, character, mod, false); } return [super _keyCommandForEvent:event]; @@ -205,7 +208,8 @@ enum int eventType = eventMem ? *(int*)&eventMem[8] : 0; if (eventType == GSEVENT_TYPE_KEYDOWN || eventType == GSEVENT_TYPE_KEYUP) - apple_input_keyboard_event(eventType == GSEVENT_TYPE_KEYDOWN, *(uint16_t*)&eventMem[0x3C], 0, 0); + apple_input_keyboard_event(eventType == GSEVENT_TYPE_KEYDOWN, + *(uint16_t*)&eventMem[0x3C], 0, 0, false); } } diff --git a/input/drivers/rwebinput_input.c b/input/drivers/rwebinput_input.c index c5499519c0..4a93d9768c 100644 --- a/input/drivers/rwebinput_input.c +++ b/input/drivers/rwebinput_input.c @@ -172,7 +172,9 @@ static void rwebinput_input_poll(void *data) for (k = 0; diff; diff >>= 1, k++) { if (diff & 1) - input_keyboard_event((state->keys[i] & (1 << k)) != 0, input_keymaps_translate_keysym_to_rk(i * 8 + k), 0, 0); + input_keyboard_event((state->keys[i] & (1 << k)) != 0, + input_keymaps_translate_keysym_to_rk(i * 8 + k), 0, 0, + false); } } diff --git a/input/drivers/sdl_input.c b/input/drivers/sdl_input.c index c365c4f73a..95aa0e6013 100644 --- a/input/drivers/sdl_input.c +++ b/input/drivers/sdl_input.c @@ -345,7 +345,7 @@ static void sdl_input_poll(void *data) if (event.key.keysym.mod & KMOD_CAPS) mod |= RETROKMOD_CAPSLOCK; - input_keyboard_event(event.type == SDL_KEYDOWN, code, code, mod); + input_keyboard_event(event.type == SDL_KEYDOWN, code, code, mod, false); } #ifdef HAVE_SDL2 else if (event.type == SDL_MOUSEWHEEL) diff --git a/input/keyboard_event_apple.c b/input/keyboard_event_apple.c index 9564029c2e..e143ff1387 100644 --- a/input/keyboard_event_apple.c +++ b/input/keyboard_event_apple.c @@ -158,5 +158,6 @@ void apple_input_keyboard_event(bool down, apple->key_state[code] = down; input_keyboard_event(down, - input_keymaps_translate_keysym_to_rk(code), character, (enum retro_mod)mod); + input_keymaps_translate_keysym_to_rk(code), + character, (enum retro_mod)mod, false); } diff --git a/input/keyboard_event_win32.c b/input/keyboard_event_win32.c index f60573a20e..a6e04125c4 100644 --- a/input/keyboard_event_win32.c +++ b/input/keyboard_event_win32.c @@ -46,25 +46,25 @@ LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message, * WM_CHAR and WM_KEYDOWN properly. */ case WM_CHAR: - input_keyboard_event(true, RETROK_UNKNOWN, wparam, mod); + input_keyboard_event(true, RETROK_UNKNOWN, wparam, mod, false); return TRUE; case WM_KEYDOWN: /* DirectInput uses scancodes directly. */ - input_keyboard_event(true, keycode, 0, mod); + input_keyboard_event(true, keycode, 0, mod, false); return 0; case WM_KEYUP: /* DirectInput uses scancodes directly. */ - input_keyboard_event(false, keycode, 0, mod); + input_keyboard_event(false, keycode, 0, mod, false); return 0; case WM_SYSKEYUP: - input_keyboard_event(false, keycode, 0, mod); + input_keyboard_event(false, keycode, 0, mod, false); return 0; case WM_SYSKEYDOWN: - input_keyboard_event(true, keycode, 0, mod); + input_keyboard_event(true, keycode, 0, mod, false); switch (wparam) { diff --git a/input/keyboard_event_x11.c b/input/keyboard_event_x11.c index 836fc0965a..29845b1f09 100644 --- a/input/keyboard_event_x11.c +++ b/input/keyboard_event_x11.c @@ -122,8 +122,9 @@ void x11_handle_key_event(XEvent *event, XIC ic, bool filter) if (state & Mod4Mask) mod |= RETROKMOD_META; - input_keyboard_event(down, key, chars[0], mod); + input_keyboard_event(down, key, chars[0], mod, false); for (i = 1; i < num; i++) - input_keyboard_event(down, RETROK_UNKNOWN, chars[i], mod); + input_keyboard_event(down, RETROK_UNKNOWN, + chars[i], mod, false); } diff --git a/input/keyboard_event_xkb.c b/input/keyboard_event_xkb.c index 3287c6b85d..eb49946927 100644 --- a/input/keyboard_event_xkb.c +++ b/input/keyboard_event_xkb.c @@ -61,8 +61,9 @@ void handle_xkb( } input_keyboard_event(value, input_keymaps_translate_keysym_to_rk(code), - num_syms ? xkb_keysym_to_utf32(syms[0]) : 0, mod); + num_syms ? xkb_keysym_to_utf32(syms[0]) : 0, mod, false); for (i = 1; i < num_syms; i++) - input_keyboard_event(value, RETROK_UNKNOWN, xkb_keysym_to_utf32(syms[i]), mod); + input_keyboard_event(value, RETROK_UNKNOWN, + xkb_keysym_to_utf32(syms[i]), mod, false); } diff --git a/input/keyboard_line.c b/input/keyboard_line.c index e2c9492551..cd287d6fd2 100644 --- a/input/keyboard_line.c +++ b/input/keyboard_line.c @@ -216,7 +216,7 @@ void input_keyboard_wait_keys_cancel(void) * This interfaces with the global driver struct and libretro callbacks. **/ void input_keyboard_event(bool down, unsigned code, - uint32_t character, uint16_t mod) + uint32_t character, uint16_t mod, bool enable_osk) { static bool deferred_wait_keys; @@ -242,7 +242,13 @@ void input_keyboard_event(bool down, unsigned code, { if (!down) return; - if (!input_keyboard_line_event(g_keyboard_line, character)) + + if (enable_osk && code != 0x12d) + { + if (!input_keyboard_line_event(g_keyboard_line, (char)code)) + return; + } + else if (!input_keyboard_line_event(g_keyboard_line, character)) return; /* Line is complete, can free it now. */ diff --git a/input/keyboard_line.h b/input/keyboard_line.h index 022de3edc9..b824f2249c 100644 --- a/input/keyboard_line.h +++ b/input/keyboard_line.h @@ -92,12 +92,13 @@ void input_keyboard_line_free(input_keyboard_line_t *state); * @code : Keycode. * @character : Character inputted. * @mod : TODO/FIXME: ??? + * @enable_osk : Fire off keyboard event from OSK * * Keyboard event utils. Called by drivers when keyboard events are fired. * This interfaces with the global driver struct and libretro callbacks. **/ void input_keyboard_event(bool down, unsigned code, uint32_t character, - uint16_t mod); + uint16_t mod, bool enable_osk); /** * input_keyboard_start_line: diff --git a/libretro_version_1.c b/libretro_version_1.c index b49c187e66..4b8466271e 100644 --- a/libretro_version_1.c +++ b/libretro_version_1.c @@ -535,7 +535,8 @@ static inline void input_poll_overlay(void) for (j = 0; j < 32; j++) if ((orig_bits & (1 << j)) != (new_bits & (1 << j))) - input_keyboard_event(new_bits & (1 << j), i * 32 + j, 0, key_mod); + input_keyboard_event(new_bits & (1 << j), + i * 32 + j, 0, key_mod, true); } } diff --git a/menu/menu_input.c b/menu/menu_input.c index c612929198..2e0b87f8c3 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -152,6 +152,16 @@ void menu_input_key_event(bool down, unsigned keycode, } } +void menu_input_osk_key_event(bool down, unsigned keycode, + uint32_t character, uint16_t mod) +{ + if (!driver.menu) + return; + + RARCH_LOG("down: %d, keycode: %d, character: %d, mod: %d.\n", + down, keycode, character, mod); +} + void menu_input_poll_bind_state(struct menu_bind_state *state) { unsigned i, b, a, h; diff --git a/menu/menu_input.h b/menu/menu_input.h index 66cd3160e5..c6cd441826 100644 --- a/menu/menu_input.h +++ b/menu/menu_input.h @@ -46,6 +46,9 @@ typedef enum void menu_input_key_event(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers); +void menu_input_osk_key_event(bool down, unsigned keycode, + uint32_t character, uint16_t mod); + void menu_input_key_start_line(void *data, const char *label, const char *label_setting, unsigned type, unsigned idx, input_keyboard_line_complete_t cb);