1
0
Fork 0

Fix numeric keypad support on Mac.

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.
This commit is contained in:
James Turner 2013-01-31 18:42:34 +00:00
parent 5b38e00ade
commit 0729b0806e

View 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;