Added support for keypad enter
authorSam Lantinga <slouken@libsdl.org>
Sun, 10 Feb 2008 05:34:33 +0000
changeset 2313 012ec5192dfa
parent 2312 bcec4b189f5b
child 2314 33052794de27
Added support for keypad enter
src/events/scancodes_win32.h
src/video/win32/SDL_win32events.c
--- a/src/events/scancodes_win32.h	Sun Feb 10 05:14:28 2008 +0000
+++ b/src/events/scancodes_win32.h	Sun Feb 10 05:34:33 2008 +0000
@@ -37,7 +37,7 @@
     /*  7, 0x07 */      SDL_SCANCODE_UNKNOWN,
     /*  8, 0x08 */      SDL_SCANCODE_BACKSPACE,
     /*  9, 0x09 */      SDL_SCANCODE_TAB,
-    /*  10, 0x0a */     SDL_SCANCODE_UNKNOWN,
+    /*  10, 0x0a */     SDL_SCANCODE_KP_ENTER, /* Not a VKEY, SDL specific */
     /*  11, 0x0b */     SDL_SCANCODE_UNKNOWN,
     /*  12, 0x0c */     SDL_SCANCODE_CLEAR,
     /*  13, 0x0d */     SDL_SCANCODE_RETURN,
--- a/src/video/win32/SDL_win32events.c	Sun Feb 10 05:14:28 2008 +0000
+++ b/src/video/win32/SDL_win32events.c	Sun Feb 10 05:34:33 2008 +0000
@@ -36,6 +36,8 @@
 #define REPEATED_KEYMASK	(1<<30)
 #define EXTENDED_KEYMASK	(1<<24)
 
+#define VK_ENTER    10  /* Keypad Enter ... no VKEY defined? */
+
 /* Make sure XBUTTON stuff is defined that isn't in older Platform SDKs... */
 #ifndef WM_XBUTTONDOWN
 #define WM_XBUTTONDOWN 0x020B
@@ -362,6 +364,10 @@
                 else
                     wParam = VK_LMENU;
                 break;
+            case VK_RETURN:
+                if (lParam & EXTENDED_KEYMASK)
+                    wParam = VK_ENTER;
+                break;
             }
             if (wParam < 256) {
                 SDL_SendKeyboardKey(index, SDL_PRESSED,
@@ -406,6 +412,10 @@
                 else
                     wParam = VK_LMENU;
                 break;
+            case VK_RETURN:
+                if (lParam & EXTENDED_KEYMASK)
+                    wParam = VK_ENTER;
+                break;
             }
             /* Windows only reports keyup for print screen */
             if (wParam == VK_SNAPSHOT