If we get a newline character, treat it as SDLK_RETURN

Fixes https://github.com/libsdl-org/SDL/issues/10679
This commit is contained in:
Sam Lantinga
2024-10-17 17:50:04 -07:00
parent a432abf4cc
commit faa404a652

View File

@@ -637,7 +637,12 @@ void SDL_SendKeyboardUnicodeKey(Uint64 timestamp, Uint32 ch)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
SDL_Keymod modstate = SDL_KMOD_NONE;
SDL_Scancode scancode = SDL_GetKeymapScancode(keyboard->keymap, ch, &modstate);
SDL_Scancode scancode;
if (ch == '\n') {
ch = SDLK_RETURN;
}
scancode = SDL_GetKeymapScancode(keyboard->keymap, ch, &modstate);
// Make sure we have this keycode in our keymap
if (scancode == SDL_SCANCODE_UNKNOWN && ch < SDLK_SCANCODE_MASK) {