Răsfoiți Sursa

If we get a newline character, treat it as SDLK_RETURN

Fixes https://github.com/libsdl-org/SDL/issues/10679
Sam Lantinga 6 luni în urmă
părinte
comite
faa404a652
1 a modificat fișierele cu 6 adăugiri și 1 ștergeri
  1. 6 1
      src/events/SDL_keyboard.c

+ 6 - 1
src/events/SDL_keyboard.c

@@ -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) {