diff --git a/src/Input/input.cxx b/src/Input/input.cxx index 09ef2c21d..2547e523d 100644 --- a/src/Input/input.cxx +++ b/src/Input/input.cxx @@ -114,6 +114,12 @@ getModSuper () return bool(fgGetKeyModifiers() & KEYMOD_SUPER); } +static bool +getModHyper () +{ + return bool(fgGetKeyModifiers() & KEYMOD_HYPER); +} + //////////////////////////////////////////////////////////////////////// // Implementation of FGInput. @@ -165,6 +171,7 @@ FGInput::bind () fgTie("/devices/status/keyboard/alt", getModAlt); fgTie("/devices/status/keyboard/meta", getModMeta); fgTie("/devices/status/keyboard/super", getModSuper); + fgTie("/devices/status/keyboard/hyper", getModHyper); _key_event->tie("key", SGRawValuePointer(&_key_code)); _key_event->tie("pressed", SGRawValuePointer(&_key_pressed)); @@ -174,6 +181,7 @@ FGInput::bind () _key_event->tie("modifier/alt", SGRawValuePointer(&_key_alt)); _key_event->tie("modifier/meta", SGRawValuePointer(&_key_meta)); _key_event->tie("modifier/super", SGRawValuePointer(&_key_super)); + _key_event->tie("modifier/hyper", SGRawValuePointer(&_key_hyper)); } void @@ -184,6 +192,7 @@ FGInput::unbind () fgUntie("/devices/status/keyboard/alt"); fgUntie("/devices/status/keyboard/meta"); fgUntie("/devices/status/keyboard/super"); + fgUntie("/devices/status/keyboard/hyper"); _key_event->untie("key"); _key_event->untie("pressed"); @@ -193,6 +202,7 @@ FGInput::unbind () _key_event->untie("modifier/alt"); _key_event->untie("modifier/meta"); _key_event->untie("modifier/super"); + _key_event->untie("modifier/hyper"); } void @@ -247,6 +257,7 @@ FGInput::doKey (int k, int modifiers, int x, int y) _key_alt = bool(modifiers & KEYMOD_ALT); _key_meta = bool(modifiers & KEYMOD_META); _key_super = bool(modifiers & KEYMOD_SUPER); + _key_hyper = bool(modifiers & KEYMOD_HYPER); _key_event->fireValueChanged(); if (!_key_code) return; @@ -981,6 +992,10 @@ FGInput::_read_bindings (const SGPropertyNode * node, if (node->getChild("mod-super") != 0) _read_bindings(node->getChild("mod-super"), binding_list, modifiers|KEYMOD_SUPER); + + if (node->getChild("mod-hyper") != 0) + _read_bindings(node->getChild("mod-hyper"), binding_list, + modifiers|KEYMOD_HYPER); } diff --git a/src/Input/input.hxx b/src/Input/input.hxx index eef9e2434..d6b75c5f1 100644 --- a/src/Input/input.hxx +++ b/src/Input/input.hxx @@ -341,6 +341,7 @@ private: bool _key_alt; bool _key_meta; bool _key_super; + bool _key_hyper; }; #endif // _INPUT_HXX diff --git a/src/Main/FGManipulator.cxx b/src/Main/FGManipulator.cxx index a7b1c60bc..92465ce78 100644 --- a/src/Main/FGManipulator.cxx +++ b/src/Main/FGManipulator.cxx @@ -95,18 +95,23 @@ osg::Node* FGManipulator::getNode() static int osgToFGModifiers(int modifiers) { int result = 0; - if (modifiers & (osgGA::GUIEventAdapter::MODKEY_LEFT_SHIFT | - osgGA::GUIEventAdapter::MODKEY_RIGHT_SHIFT)) - result |= KEYMOD_SHIFT; - if (modifiers & (osgGA::GUIEventAdapter::MODKEY_LEFT_CTRL | - osgGA::GUIEventAdapter::MODKEY_RIGHT_CTRL)) - result |= KEYMOD_CTRL; - if (modifiers & (osgGA::GUIEventAdapter::MODKEY_LEFT_ALT | - osgGA::GUIEventAdapter::MODKEY_RIGHT_ALT)) - result |= KEYMOD_ALT; - if (modifiers & (osgGA::GUIEventAdapter::MODKEY_LEFT_META | - osgGA::GUIEventAdapter::MODKEY_RIGHT_META)) - result |= KEYMOD_META; + if (modifiers & osgGA::GUIEventAdapter::MODKEY_SHIFT) + result |= KEYMOD_SHIFT; + + if (modifiers & osgGA::GUIEventAdapter::MODKEY_CTRL) + result |= KEYMOD_CTRL; + + if (modifiers & osgGA::GUIEventAdapter::MODKEY_ALT) + result |= KEYMOD_ALT; + + if (modifiers & osgGA::GUIEventAdapter::MODKEY_META) + result |= KEYMOD_META; + + if (modifiers & osgGA::GUIEventAdapter::MODKEY_SUPER) + result |= KEYMOD_SUPER; + + if (modifiers & osgGA::GUIEventAdapter::MODKEY_HYPER) + result |= KEYMOD_HYPER; return result; } diff --git a/src/Main/fg_os.hxx b/src/Main/fg_os.hxx index 43bea933a..48a29cdc6 100644 --- a/src/Main/fg_os.hxx +++ b/src/Main/fg_os.hxx @@ -29,7 +29,8 @@ enum { KEYMOD_NONE = 0, KEYMOD_ALT = 8, KEYMOD_META = 16, KEYMOD_SUPER = 32, - KEYMOD_MAX = 64 }; + KEYMOD_HYPER = 64, + KEYMOD_MAX = 128 }; // A note on key codes: none are defined here. FlightGear has no // hard-coded interpretations of codes other than modifier keys, so we