From 8f509ba82a7c89a5cb487dbbef9c19f6a9081bd6 Mon Sep 17 00:00:00 2001 From: mfranz Date: Sat, 26 Apr 2008 17:01:08 +0000 Subject: [PATCH] restore NumPad translation --- src/Main/FGManipulator.cxx | 9 ++++----- src/Main/FGManipulator.hxx | 2 -- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Main/FGManipulator.cxx b/src/Main/FGManipulator.cxx index 92465ce78..905e89496 100644 --- a/src/Main/FGManipulator.cxx +++ b/src/Main/FGManipulator.cxx @@ -39,8 +39,9 @@ FGManipulator::FGManipulator() : statsHandler->setKeyEventPrintsOutStats(printStatsKey); statsEvent->setEventType(GUIEventAdapter::KEYDOWN); -#if 0 - // We have to implement numlock too. + // OSG reports KeyPad keycodes independent of the NumLock modifier. + // KP-4/KP-Left is always KEY_KP_Left (ff96), so we have to generate + // the locked keys ourselves. numlockKeyMap[GUIEventAdapter::KEY_KP_Insert] = '0'; numlockKeyMap[GUIEventAdapter::KEY_KP_End] = '1'; numlockKeyMap[GUIEventAdapter::KEY_KP_Down] = '2'; @@ -51,7 +52,6 @@ FGManipulator::FGManipulator() : numlockKeyMap[GUIEventAdapter::KEY_KP_Home] = '7'; numlockKeyMap[GUIEventAdapter::KEY_KP_Up] = '8'; numlockKeyMap[GUIEventAdapter::KEY_KP_Page_Up] = '9'; -#endif for (int i = 0; i < 128; i++) release_keys[i] = i; @@ -278,7 +278,6 @@ void FGManipulator::handleKey(const osgGA::GUIEventAdapter& ea, int& key, } osgGA::GUIEventAdapter::EventType eventType = ea.getEventType(); -#if 0 std::map::iterator numPadIter = numlockKeyMap.find(key); if (numPadIter != numlockKeyMap.end()) { @@ -286,7 +285,7 @@ void FGManipulator::handleKey(const osgGA::GUIEventAdapter& ea, int& key, key = numPadIter->second; } } -#endif + modifiers = osgToFGModifiers(ea.getModKeyMask()); currentModifiers = modifiers; if (eventType == osgGA::GUIEventAdapter::KEYUP) diff --git a/src/Main/FGManipulator.hxx b/src/Main/FGManipulator.hxx index 7e39fe855..95329c19c 100644 --- a/src/Main/FGManipulator.hxx +++ b/src/Main/FGManipulator.hxx @@ -131,9 +131,7 @@ protected: osg::ref_ptr statsEvent; int statsType; int currentModifiers; -#if 0 std::map numlockKeyMap; -#endif osg::Vec3d position; osg::Quat attitude; void handleKey(const osgGA::GUIEventAdapter& ea, int& key, int& modifiers);