Fixed bug 4443 - Incorrect scan code reported for numpad 5
authorSam Lantinga
Sat, 08 Jun 2019 10:47:43 -0700
changeset 1277074ba5a85d682
parent 12769 096f2f3c4bdc
child 12771 f26b341b14b4
Fixed bug 4443 - Incorrect scan code reported for numpad 5

bplu4t2f

When num lock is on, the scancode reported for numpad 5 is SDL_SCANCODE_KP_5, which is correct. However, when num lock is off, windows reports the VK_CLEAR virtual key code, which is incorrectly translated into SDL_SCANCODE_CLEAR inside of the VKeytoScancode(WPARAM vkey) function.
src/video/windows/SDL_windowsevents.c
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Tue Apr 30 20:37:49 2019 -0700
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Sat Jun 08 10:47:43 2019 -0700
     1.3 @@ -86,7 +86,9 @@
     1.4  VKeytoScancode(WPARAM vkey)
     1.5  {
     1.6      switch (vkey) {
     1.7 +/* Windows generates this virtual keycode for Keypad 5 when NumLock is off.
     1.8      case VK_CLEAR: return SDL_SCANCODE_CLEAR;
     1.9 +*/
    1.10      case VK_MODECHANGE: return SDL_SCANCODE_MODE;
    1.11      case VK_SELECT: return SDL_SCANCODE_SELECT;
    1.12      case VK_EXECUTE: return SDL_SCANCODE_EXECUTE;