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

@@ -106,13 +106,7 @@ void WIN_UpdateKeymap(SDL_bool send_event)
/* Make sure this scancode is a valid character scancode */
scancode = windows_scancode_table[i];
if (scancode == SDL_SCANCODE_UNKNOWN ||
(SDL_GetDefaultKeyFromScancode(scancode, SDL_KMOD_NONE) & SDLK_SCANCODE_MASK)) {
continue;
}
/* If this key is one of the non-mappable keys, ignore it */
/* Uncomment the second part to re-enable the behavior of not mapping the "`"(grave) key to the users actual keyboard layout */
if (scancode == SDL_SCANCODE_DELETE /*|| scancode == SDL_SCANCODE_GRAVE*/) {
scancode >= SDL_SCANCODE_CAPSLOCK) {
continue;
}