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.
This commit is contained in:
Sam Lantinga
2024-08-05 09:28:06 -07:00
parent b7aca89466
commit eac8e858d5

View File

@@ -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;