Numpad scancodes have non-numpad keycodes

This allows the numpad to work as the user expects based on the numlock state. If the application needs to distinguish the keys, it can check to see whether the scancode is a numpad key or not.
This commit is contained in:
Sam Lantinga 2024-06-30 23:35:23 -07:00
parent 78dbf9be50
commit d4497ecdbd
8 changed files with 316 additions and 352 deletions

View file

@ -334,8 +334,8 @@ static SDL_Keycode SDL_GetEventKeycode(SDL_Keyboard *keyboard, SDL_Scancode scan
{
SDL_bool shifted = (modstate & SDL_KMOD_SHIFT) != 0;
// We won't be applying any modifiers by default
modstate = SDL_KMOD_NONE;
// We won't be applying any modifiers except numlock by default
modstate &= SDL_KMOD_NUM;
if (scancode >= SDL_SCANCODE_A && scancode <= SDL_SCANCODE_Z) {
if (keyboard->non_latin_letters && (keyboard->keycode_options & KEYCODE_OPTION_LATIN_LETTERS)) {