add hyper support
This commit is contained in:
parent
dd3fbd50d8
commit
160e246a0c
4 changed files with 35 additions and 13 deletions
|
@ -114,6 +114,12 @@ getModSuper ()
|
||||||
return bool(fgGetKeyModifiers() & KEYMOD_SUPER);
|
return bool(fgGetKeyModifiers() & KEYMOD_SUPER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
getModHyper ()
|
||||||
|
{
|
||||||
|
return bool(fgGetKeyModifiers() & KEYMOD_HYPER);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Implementation of FGInput.
|
// Implementation of FGInput.
|
||||||
|
@ -165,6 +171,7 @@ FGInput::bind ()
|
||||||
fgTie("/devices/status/keyboard/alt", getModAlt);
|
fgTie("/devices/status/keyboard/alt", getModAlt);
|
||||||
fgTie("/devices/status/keyboard/meta", getModMeta);
|
fgTie("/devices/status/keyboard/meta", getModMeta);
|
||||||
fgTie("/devices/status/keyboard/super", getModSuper);
|
fgTie("/devices/status/keyboard/super", getModSuper);
|
||||||
|
fgTie("/devices/status/keyboard/hyper", getModHyper);
|
||||||
|
|
||||||
_key_event->tie("key", SGRawValuePointer<int>(&_key_code));
|
_key_event->tie("key", SGRawValuePointer<int>(&_key_code));
|
||||||
_key_event->tie("pressed", SGRawValuePointer<bool>(&_key_pressed));
|
_key_event->tie("pressed", SGRawValuePointer<bool>(&_key_pressed));
|
||||||
|
@ -174,6 +181,7 @@ FGInput::bind ()
|
||||||
_key_event->tie("modifier/alt", SGRawValuePointer<bool>(&_key_alt));
|
_key_event->tie("modifier/alt", SGRawValuePointer<bool>(&_key_alt));
|
||||||
_key_event->tie("modifier/meta", SGRawValuePointer<bool>(&_key_meta));
|
_key_event->tie("modifier/meta", SGRawValuePointer<bool>(&_key_meta));
|
||||||
_key_event->tie("modifier/super", SGRawValuePointer<bool>(&_key_super));
|
_key_event->tie("modifier/super", SGRawValuePointer<bool>(&_key_super));
|
||||||
|
_key_event->tie("modifier/hyper", SGRawValuePointer<bool>(&_key_hyper));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -184,6 +192,7 @@ FGInput::unbind ()
|
||||||
fgUntie("/devices/status/keyboard/alt");
|
fgUntie("/devices/status/keyboard/alt");
|
||||||
fgUntie("/devices/status/keyboard/meta");
|
fgUntie("/devices/status/keyboard/meta");
|
||||||
fgUntie("/devices/status/keyboard/super");
|
fgUntie("/devices/status/keyboard/super");
|
||||||
|
fgUntie("/devices/status/keyboard/hyper");
|
||||||
|
|
||||||
_key_event->untie("key");
|
_key_event->untie("key");
|
||||||
_key_event->untie("pressed");
|
_key_event->untie("pressed");
|
||||||
|
@ -193,6 +202,7 @@ FGInput::unbind ()
|
||||||
_key_event->untie("modifier/alt");
|
_key_event->untie("modifier/alt");
|
||||||
_key_event->untie("modifier/meta");
|
_key_event->untie("modifier/meta");
|
||||||
_key_event->untie("modifier/super");
|
_key_event->untie("modifier/super");
|
||||||
|
_key_event->untie("modifier/hyper");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -247,6 +257,7 @@ FGInput::doKey (int k, int modifiers, int x, int y)
|
||||||
_key_alt = bool(modifiers & KEYMOD_ALT);
|
_key_alt = bool(modifiers & KEYMOD_ALT);
|
||||||
_key_meta = bool(modifiers & KEYMOD_META);
|
_key_meta = bool(modifiers & KEYMOD_META);
|
||||||
_key_super = bool(modifiers & KEYMOD_SUPER);
|
_key_super = bool(modifiers & KEYMOD_SUPER);
|
||||||
|
_key_hyper = bool(modifiers & KEYMOD_HYPER);
|
||||||
_key_event->fireValueChanged();
|
_key_event->fireValueChanged();
|
||||||
if (!_key_code)
|
if (!_key_code)
|
||||||
return;
|
return;
|
||||||
|
@ -981,6 +992,10 @@ FGInput::_read_bindings (const SGPropertyNode * node,
|
||||||
if (node->getChild("mod-super") != 0)
|
if (node->getChild("mod-super") != 0)
|
||||||
_read_bindings(node->getChild("mod-super"), binding_list,
|
_read_bindings(node->getChild("mod-super"), binding_list,
|
||||||
modifiers|KEYMOD_SUPER);
|
modifiers|KEYMOD_SUPER);
|
||||||
|
|
||||||
|
if (node->getChild("mod-hyper") != 0)
|
||||||
|
_read_bindings(node->getChild("mod-hyper"), binding_list,
|
||||||
|
modifiers|KEYMOD_HYPER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -341,6 +341,7 @@ private:
|
||||||
bool _key_alt;
|
bool _key_alt;
|
||||||
bool _key_meta;
|
bool _key_meta;
|
||||||
bool _key_super;
|
bool _key_super;
|
||||||
|
bool _key_hyper;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _INPUT_HXX
|
#endif // _INPUT_HXX
|
||||||
|
|
|
@ -95,18 +95,23 @@ osg::Node* FGManipulator::getNode()
|
||||||
static int osgToFGModifiers(int modifiers)
|
static int osgToFGModifiers(int modifiers)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (modifiers & (osgGA::GUIEventAdapter::MODKEY_LEFT_SHIFT |
|
if (modifiers & osgGA::GUIEventAdapter::MODKEY_SHIFT)
|
||||||
osgGA::GUIEventAdapter::MODKEY_RIGHT_SHIFT))
|
result |= KEYMOD_SHIFT;
|
||||||
result |= KEYMOD_SHIFT;
|
|
||||||
if (modifiers & (osgGA::GUIEventAdapter::MODKEY_LEFT_CTRL |
|
if (modifiers & osgGA::GUIEventAdapter::MODKEY_CTRL)
|
||||||
osgGA::GUIEventAdapter::MODKEY_RIGHT_CTRL))
|
result |= KEYMOD_CTRL;
|
||||||
result |= KEYMOD_CTRL;
|
|
||||||
if (modifiers & (osgGA::GUIEventAdapter::MODKEY_LEFT_ALT |
|
if (modifiers & osgGA::GUIEventAdapter::MODKEY_ALT)
|
||||||
osgGA::GUIEventAdapter::MODKEY_RIGHT_ALT))
|
result |= KEYMOD_ALT;
|
||||||
result |= KEYMOD_ALT;
|
|
||||||
if (modifiers & (osgGA::GUIEventAdapter::MODKEY_LEFT_META |
|
if (modifiers & osgGA::GUIEventAdapter::MODKEY_META)
|
||||||
osgGA::GUIEventAdapter::MODKEY_RIGHT_META))
|
result |= KEYMOD_META;
|
||||||
result |= KEYMOD_META;
|
|
||||||
|
if (modifiers & osgGA::GUIEventAdapter::MODKEY_SUPER)
|
||||||
|
result |= KEYMOD_SUPER;
|
||||||
|
|
||||||
|
if (modifiers & osgGA::GUIEventAdapter::MODKEY_HYPER)
|
||||||
|
result |= KEYMOD_HYPER;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@ enum { KEYMOD_NONE = 0,
|
||||||
KEYMOD_ALT = 8,
|
KEYMOD_ALT = 8,
|
||||||
KEYMOD_META = 16,
|
KEYMOD_META = 16,
|
||||||
KEYMOD_SUPER = 32,
|
KEYMOD_SUPER = 32,
|
||||||
KEYMOD_MAX = 64 };
|
KEYMOD_HYPER = 64,
|
||||||
|
KEYMOD_MAX = 128 };
|
||||||
|
|
||||||
// A note on key codes: none are defined here. FlightGear has no
|
// A note on key codes: none are defined here. FlightGear has no
|
||||||
// hard-coded interpretations of codes other than modifier keys, so we
|
// hard-coded interpretations of codes other than modifier keys, so we
|
||||||
|
|
Loading…
Reference in a new issue