Fixed numpad usage
This commit is contained in:
parent
1e90105944
commit
89e2defb5b
|
@ -101,6 +101,8 @@ static const char *numpad[] = { "end", "down", "pagedown", "left", "", "right",
|
|||
|
||||
static const char *get_key_name(const SDL_Event *e, char *buf) {
|
||||
SDL_Scancode scancode = e->key.keysym.scancode;
|
||||
|
||||
#if !defined(__amigaos4__) && !defined(__MORPHOS__)
|
||||
/* Is the scancode from the keypad and the number-lock off?
|
||||
** We assume that SDL_SCANCODE_KP_1 up to SDL_SCANCODE_KP_9 and SDL_SCANCODE_KP_0
|
||||
** and SDL_SCANCODE_KP_PERIOD are declared in SDL2 in that order. */
|
||||
|
@ -108,6 +110,8 @@ 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 {
|
||||
#endif
|
||||
|
||||
/* We need to correctly handle non-standard layouts such as dvorak.
|
||||
Therefore, if a Latin letter(code<128) is pressed in the current layout,
|
||||
then we transmit it as it is. But we also need to support shortcuts in
|
||||
|
@ -119,7 +123,10 @@ static const char *get_key_name(const SDL_Event *e, char *buf) {
|
|||
strcpy(buf, SDL_GetScancodeName(scancode));
|
||||
str_tolower(buf);
|
||||
return buf;
|
||||
|
||||
#if !defined(__amigaos4__) && !defined(__MORPHOS__)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int f_poll_event(lua_State *L) {
|
||||
|
|
Loading…
Reference in New Issue