Correct definition of the pressed key for different layouts and languages

This commit is contained in:
Jipok 2021-12-19 00:24:28 +05:00 committed by Guldoman
parent 21dddf34f8
commit c7f5e92bb8
No known key found for this signature in database
GPG Key ID: C08A498EC7F1AFDD
1 changed files with 4 additions and 1 deletions

View File

@ -104,7 +104,10 @@ static const char *get_key_name(const SDL_Event *e, char *buf) {
!(e->key.keysym.mod & KMOD_NUM)) {
return numpad[scancode - SDL_SCANCODE_KP_1];
} else {
strcpy(buf, SDL_GetScancodeName(e->key.keysym.scancode));
if (e->key.keysym.sym <= 128)
strcpy(buf, SDL_GetKeyName(e->key.keysym.sym));
else
strcpy(buf, SDL_GetScancodeName(scancode));
str_tolower(buf);
return buf;
}