diff src/video/win32/SDL_win32events.c @ 3700:076c12750bc4

Fixed bug #743 The arrow keys and keypad arrow keys have almost the same scancodes!
author Sam Lantinga <slouken@libsdl.org>
date Wed, 27 Jan 2010 05:14:22 +0000
parents f7b03b6838cb
children faa9fc8e7f67
line wrap: on
line diff
--- 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;
+            }
         }
     }