]> git.saurik.com Git - wxWidgets.git/commitdiff
issue NUMPAD constants only for Key but not for Char events, fixes #15073
authorStefan Csomor <csomor@advancedconcepts.ch>
Sun, 3 Mar 2013 17:23:58 +0000 (17:23 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sun, 3 Mar 2013 17:23:58 +0000 (17:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73597 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/window.mm

index 351bfe1f5337127156b7035c374b3b82ff1b28b0..dfb8035dac6933364cb7cb92b76d68a95e05b28c 100644 (file)
@@ -293,59 +293,70 @@ long wxOSXTranslateCocoaKey( NSEvent* event, int eventType )
         case 48:
             retval = WXK_TAB;
             break;
-
-        case 75: // /
-            retval = WXK_NUMPAD_DIVIDE;
-            break;
-        case 67: // *
-            retval = WXK_NUMPAD_MULTIPLY;
-            break;
-        case 78: // -
-            retval = WXK_NUMPAD_SUBTRACT;
-            break;
-        case 69: // +
-            retval = WXK_NUMPAD_ADD;
-            break;
-        case 76: // Enter
-            retval = WXK_NUMPAD_ENTER;
-            break;
-        case 65: // .
-            retval = WXK_NUMPAD_DECIMAL;
-            break;
-        case 82: // 0
-            retval = WXK_NUMPAD0;
-            break;
-        case 83: // 1
-            retval = WXK_NUMPAD1;
-            break;
-        case 84: // 2
-            retval = WXK_NUMPAD2;
-            break;
-        case 85: // 3
-            retval = WXK_NUMPAD3;
-            break;
-        case 86: // 4
-            retval = WXK_NUMPAD4;
-            break;
-        case 87: // 5
-            retval = WXK_NUMPAD5;
-            break;
-        case 88: // 6
-            retval = WXK_NUMPAD6;
-            break;
-        case 89: // 7
-            retval = WXK_NUMPAD7;
-            break;
-        case 91: // 8
-            retval = WXK_NUMPAD8;
-            break;
-        case 92: // 9
-            retval = WXK_NUMPAD9;
-            break;
         default:
-            //retval = [event keyCode];
             break;
     }
+    
+    // Check for NUMPAD keys.  For KEY_UP/DOWN events we need to use the
+    // WXK_NUMPAD constants, but for the CHAR event we want to use the
+    // standard ascii values
+    if ( eventType != wxEVT_CHAR )
+    {
+        switch( [event keyCode] )
+        {
+            case 75: // /
+                retval = WXK_NUMPAD_DIVIDE;
+                break;
+            case 67: // *
+                retval = WXK_NUMPAD_MULTIPLY;
+                break;
+            case 78: // -
+                retval = WXK_NUMPAD_SUBTRACT;
+                break;
+            case 69: // +
+                retval = WXK_NUMPAD_ADD;
+                break;
+            case 76: // Enter
+                retval = WXK_NUMPAD_ENTER;
+                break;
+            case 65: // .
+                retval = WXK_NUMPAD_DECIMAL;
+                break;
+            case 82: // 0
+                retval = WXK_NUMPAD0;
+                break;
+            case 83: // 1
+                retval = WXK_NUMPAD1;
+                break;
+            case 84: // 2
+                retval = WXK_NUMPAD2;
+                break;
+            case 85: // 3
+                retval = WXK_NUMPAD3;
+                break;
+            case 86: // 4
+                retval = WXK_NUMPAD4;
+                break;
+            case 87: // 5
+                retval = WXK_NUMPAD5;
+                break;
+            case 88: // 6
+                retval = WXK_NUMPAD6;
+                break;
+            case 89: // 7
+                retval = WXK_NUMPAD7;
+                break;
+            case 91: // 8
+                retval = WXK_NUMPAD8;
+                break;
+            case 92: // 9
+                retval = WXK_NUMPAD9;
+                break;
+            default:
+                //retval = [event keyCode];
+                break;
+        }
+    }
     return retval;
 }