From c7f5e92bb8f59ebab22fa2507273d4365a9694ad Mon Sep 17 00:00:00 2001 From: Jipok Date: Sun, 19 Dec 2021 00:24:28 +0500 Subject: [PATCH] Correct definition of the pressed key for different layouts and languages --- src/api/system.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/system.c b/src/api/system.c index db61989b..7c98f45c 100644 --- a/src/api/system.c +++ b/src/api/system.c @@ -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; }