Fixed bug #743
authorSam Lantinga <slouken@libsdl.org>
Wed, 27 Jan 2010 05:14:22 +0000
changeset 3700076c12750bc4
parent 3699 4160ba33b597
child 3701 fb905d5674cc
Fixed bug #743

The arrow keys and keypad arrow keys have almost the same scancodes!
src/video/win32/SDL_vkeys.h
src/video/win32/SDL_win32events.c
     1.1 --- a/src/video/win32/SDL_vkeys.h	Tue Jan 26 06:01:33 2010 +0000
     1.2 +++ b/src/video/win32/SDL_vkeys.h	Wed Jan 27 05:14:22 2010 +0000
     1.3 @@ -73,4 +73,5 @@
     1.4  #define VK_APOSTROPHE	0xDE
     1.5  #define VK_BACKTICK	0xDF
     1.6  #define VK_OEM_102	0xE2
     1.7 +
     1.8  /* vi: set ts=4 sw=4 expandtab: */
     2.1 --- a/src/video/win32/SDL_win32events.c	Tue Jan 26 06:01:33 2010 +0000
     2.2 +++ b/src/video/win32/SDL_win32events.c	Wed Jan 27 05:14:22 2010 +0000
     2.3 @@ -84,11 +84,16 @@
     2.4          }
     2.5      }
     2.6  
     2.7 -    /* Keypad keys are a little trickier, we always scan for them. */
     2.8 -    for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) {
     2.9 -        if (scancode == keypad_scancodes[i]) {
    2.10 -            wParam = VK_NUMPAD0 + i;
    2.11 -            break;
    2.12 +    /* Keypad keys are a little trickier, we always scan for them.
    2.13 +       Keypad arrow keys have the same scancode as normal arrow keys,
    2.14 +       except they don't have the extended bit (0x1000000) set.
    2.15 +     */
    2.16 +    if (!(lParam & 0x1000000)) {
    2.17 +        for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) {
    2.18 +            if (scancode == keypad_scancodes[i]) {
    2.19 +                wParam = VK_NUMPAD0 + i;
    2.20 +                break;
    2.21 +            }
    2.22          }
    2.23      }
    2.24