Fixed bug #743
authorSam Lantinga <slouken@libsdl.org>
Wed, 27 Jan 2010 05:14:22 +0000
changeset 3700 076c12750bc4
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
--- a/src/video/win32/SDL_vkeys.h	Tue Jan 26 06:01:33 2010 +0000
+++ b/src/video/win32/SDL_vkeys.h	Wed Jan 27 05:14:22 2010 +0000
@@ -73,4 +73,5 @@
 #define VK_APOSTROPHE	0xDE
 #define VK_BACKTICK	0xDF
 #define VK_OEM_102	0xE2
+
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/win32/SDL_win32events.c	Tue Jan 26 06:01:33 2010 +0000
+++ b/src/video/win32/SDL_win32events.c	Wed Jan 27 05:14:22 2010 +0000
@@ -84,11 +84,16 @@
         }
     }
 
-    /* Keypad keys are a little trickier, we always scan for them. */
-    for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) {
-        if (scancode == keypad_scancodes[i]) {
-            wParam = VK_NUMPAD0 + i;
-            break;
+    /* Keypad keys are a little trickier, we always scan for them.
+       Keypad arrow keys have the same scancode as normal arrow keys,
+       except they don't have the extended bit (0x1000000) set.
+     */
+    if (!(lParam & 0x1000000)) {
+        for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) {
+            if (scancode == keypad_scancodes[i]) {
+                wParam = VK_NUMPAD0 + i;
+                break;
+            }
         }
     }