From eac8e858d5137569ad6add0a4614873743f52037 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 09:28:06 -0700 Subject: [PATCH] Fixed key names for Thai keyboards Using the shifted versions of keys for the key names doesn't make any sense on the Thai keyboard. Thai keyboards are QWERTY plus Thai characters, so let's use the ASCII key names. --- src/events/SDL_keymap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/events/SDL_keymap.c b/src/events/SDL_keymap.c index 6f9a532d8e..d777561e8c 100644 --- a/src/events/SDL_keymap.c +++ b/src/events/SDL_keymap.c @@ -1015,6 +1015,11 @@ const char *SDL_GetKeyName(SDL_Keycode key) } else if (key > 0x7F) { SDL_Scancode scancode = SDL_GetScancodeFromKey(key, SDL_KMOD_NONE); if (scancode != SDL_SCANCODE_UNKNOWN) { + if (key >= 0x0E00 && key <= 0x0E7F) { + // Thai keyboards are QWERTY plus Thai characters, so let's use the ASCII key names + return SDL_GetScancodeName(scancode); + } + SDL_Keycode capital = SDL_GetKeyFromScancode(scancode, SDL_KMOD_SHIFT); if (capital > 0x7F || (capital >= 'A' && capital <= 'Z')) { key = capital;