]> git.mxchange.org Git - flightgear.git/commitdiff
Fix numeric keypad support on Mac.
authorJames Turner <zakalawe@mac.com>
Thu, 31 Jan 2013 18:42:34 +0000 (18:42 +0000)
committerJames Turner <zakalawe@mac.com>
Thu, 31 Jan 2013 18:42:34 +0000 (18:42 +0000)
Comments in the code imply osgViewer always sends 'num-lock'-off codes, but that is not the observed behaviour with Cocoa. So adding mappings for the num-locked codes on Mac, which is what people actually want at the moment.

src/Viewer/FGEventHandler.cxx

index b0f9bcd1dd6353621a21f26f691ab61edd106185..b877cc74685fd8af2c4400282a581b0863ebb377 100644 (file)
@@ -68,6 +68,21 @@ FGEventHandler::FGEventHandler() :
     numlockKeyMap[GUIEventAdapter::KEY_KP_Page_Up] = '9';
     numlockKeyMap[GUIEventAdapter::KEY_KP_Delete] = '.';
 
+    // The comment above is incorrect on Mac osgViewer, at least. So we
+    // need to map the 'num-locked' key codes to real values.
+    numlockKeyMap[GUIEventAdapter::KEY_KP_0]  = '0';
+    numlockKeyMap[GUIEventAdapter::KEY_KP_1] = '1';
+    numlockKeyMap[GUIEventAdapter::KEY_KP_2] = '2';
+    numlockKeyMap[GUIEventAdapter::KEY_KP_3] = '3';
+    numlockKeyMap[GUIEventAdapter::KEY_KP_4] = '4';
+    numlockKeyMap[GUIEventAdapter::KEY_KP_5] = '5';
+    numlockKeyMap[GUIEventAdapter::KEY_KP_6] = '6';
+    numlockKeyMap[GUIEventAdapter::KEY_KP_7] = '7';
+    numlockKeyMap[GUIEventAdapter::KEY_KP_8] = '8';
+    numlockKeyMap[GUIEventAdapter::KEY_KP_9] = '9';
+    numlockKeyMap[GUIEventAdapter::KEY_KP_Decimal] = '.';
+
+    
     // mapping when NumLock is off
     noNumlockKeyMap[GUIEventAdapter::KEY_KP_Insert]     = PU_KEY_INSERT;
     noNumlockKeyMap[GUIEventAdapter::KEY_KP_End]        = PU_KEY_END;