Skip to content

Commit

Permalink
If we get a newline character, treat it as SDLK_RETURN
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Oct 18, 2024
1 parent a432abf commit 53f04f3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/events/SDL_keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 53f04f3

Please sign in to comment.