]> git.saurik.com Git - wxWidgets.git/commitdiff
Take account of the numlock when mapping mgl virtual keycodes to wx ones.
authorMichael Wetherell <mike.wetherell@ntlworld.com>
Sun, 28 May 2006 19:23:44 +0000 (19:23 +0000)
committerMichael Wetherell <mike.wetherell@ntlworld.com>
Sun, 28 May 2006 19:23:44 +0000 (19:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39389 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mgl/window.cpp

index e19d106905c5f7f28ba14630704e2aeb9e23cc25..d4fc3b24e520c362101ecfc4cf49a9256533a88c 100644 (file)
@@ -297,23 +297,25 @@ static long wxScanToKeyCode(event_t *event, bool translate)
 
     if ( translate )
     {
+        bool numlock = (event->modifiers & EVT_NUMLOCK) != 0;
+
         switch ( EVT_scanCode(event->message) )
         {
             KEY (KB_padMinus,       WXK_NUMPAD_SUBTRACT)
             KEY (KB_padPlus,        WXK_NUMPAD_ADD)
             KEY (KB_padTimes,       WXK_NUMPAD_MULTIPLY)
             KEY (KB_padDivide,      WXK_NUMPAD_DIVIDE)
-            KEY (KB_padCenter,      WXK_NUMPAD_SEPARATOR) // ?
-            KEY (KB_padLeft,        WXK_NUMPAD_LEFT)
-            KEY (KB_padRight,       WXK_NUMPAD_RIGHT)
-            KEY (KB_padUp,          WXK_NUMPAD_UP)
-            KEY (KB_padDown,        WXK_NUMPAD_DOWN)
-            KEY (KB_padInsert,      WXK_NUMPAD_INSERT)
-            KEY (KB_padDelete,      WXK_NUMPAD_DELETE)
-            KEY (KB_padHome,        WXK_NUMPAD_HOME)
-            KEY (KB_padEnd,         WXK_NUMPAD_END)
-            KEY (KB_padPageUp,      WXK_NUMPAD_PAGEUP)
-            KEY (KB_padPageDown,    WXK_NUMPAD_PAGEDOWN)
+            KEY (KB_padCenter,      numlock ? WXK_NUMPAD5 : WXK_NUMPAD_SEPARATOR) // ?
+            KEY (KB_padLeft,        numlock ? WXK_NUMPAD4 : WXK_NUMPAD_LEFT)
+            KEY (KB_padRight,       numlock ? WXK_NUMPAD6 : WXK_NUMPAD_RIGHT)
+            KEY (KB_padUp,          numlock ? WXK_NUMPAD8 : WXK_NUMPAD_UP)
+            KEY (KB_padDown,        numlock ? WXK_NUMPAD2 : WXK_NUMPAD_DOWN)
+            KEY (KB_padInsert,      numlock ? WXK_NUMPAD0 : WXK_NUMPAD_INSERT)
+            KEY (KB_padDelete,      numlock ? WXK_DECIMAL : WXK_NUMPAD_DELETE)
+            KEY (KB_padHome,        numlock ? WXK_NUMPAD7 : WXK_NUMPAD_HOME)
+            KEY (KB_padEnd,         numlock ? WXK_NUMPAD1 : WXK_NUMPAD_END)
+            KEY (KB_padPageUp,      numlock ? WXK_NUMPAD9 : WXK_NUMPAD_PAGEUP)
+            KEY (KB_padPageDown,    numlock ? WXK_NUMPAD3 : WXK_NUMPAD_PAGEDOWN)
             KEY (KB_1,              '1')
             KEY (KB_2,              '2')
             KEY (KB_3,              '3')