mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Merge pull request #1934 from Areloch/menubaracceleratorfix
SDL Menubar accelerator fix
This commit is contained in:
commit
810117bb66
3 changed files with 57 additions and 19 deletions
|
|
@ -429,7 +429,7 @@ struct InputEventInfo
|
||||||
U16 ascii;
|
U16 ascii;
|
||||||
|
|
||||||
/// Modifiers to action: SI_LSHIFT, SI_LCTRL, etc.
|
/// Modifiers to action: SI_LSHIFT, SI_LCTRL, etc.
|
||||||
InputModifiers modifier;
|
U32 modifier;
|
||||||
|
|
||||||
inline void postToSignal(InputEvent &ie)
|
inline void postToSignal(InputEvent &ie)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -51,23 +51,41 @@ namespace
|
||||||
{
|
{
|
||||||
U32 ret = 0;
|
U32 ret = 0;
|
||||||
|
|
||||||
if(mod & KMOD_LSHIFT)
|
if (mod & KMOD_LSHIFT)
|
||||||
ret |= IM_LSHIFT;
|
{
|
||||||
|
ret |= SI_LSHIFT;
|
||||||
|
ret |= SI_SHIFT;
|
||||||
|
}
|
||||||
|
|
||||||
if(mod & KMOD_RSHIFT)
|
if (mod & KMOD_RSHIFT)
|
||||||
ret |= IM_RSHIFT;
|
{
|
||||||
|
ret |= SI_RSHIFT;
|
||||||
|
ret |= SI_SHIFT;
|
||||||
|
}
|
||||||
|
|
||||||
if(mod & KMOD_LCTRL)
|
if (mod & KMOD_LCTRL)
|
||||||
ret |= IM_LCTRL;
|
{
|
||||||
|
ret |= SI_LCTRL;
|
||||||
|
ret |= SI_CTRL;
|
||||||
|
}
|
||||||
|
|
||||||
if(mod & KMOD_RCTRL)
|
if (mod & KMOD_RCTRL)
|
||||||
ret |= IM_RCTRL;
|
{
|
||||||
|
ret |= SI_RCTRL;
|
||||||
|
ret |= SI_CTRL;
|
||||||
|
}
|
||||||
|
|
||||||
if(mod & KMOD_LALT)
|
if (mod & KMOD_LALT)
|
||||||
ret |= IM_LALT;
|
{
|
||||||
|
ret |= SI_LALT;
|
||||||
|
ret |= SI_ALT;
|
||||||
|
}
|
||||||
|
|
||||||
if(mod & KMOD_RALT)
|
if (mod & KMOD_RALT)
|
||||||
ret |= IM_RALT;
|
{
|
||||||
|
ret |= SI_RALT;
|
||||||
|
ret |= SI_ALT;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ void WindowInputGenerator::generateInputEvent( InputEventInfo &inputEvent )
|
||||||
{
|
{
|
||||||
const AccKeyMap &acc = mAcceleratorMap[i];
|
const AccKeyMap &acc = mAcceleratorMap[i];
|
||||||
if (!mWindow->getKeyboardTranslation() &&
|
if (!mWindow->getKeyboardTranslation() &&
|
||||||
(acc.modifier & inputEvent.modifier || (acc.modifier == 0 && inputEvent.modifier == 0))
|
((acc.modifier == inputEvent.modifier && acc.modifier != 0) || (acc.modifier == 0 && inputEvent.modifier == 0))
|
||||||
&& acc.keyCode == inputEvent.objInst)
|
&& acc.keyCode == inputEvent.objInst)
|
||||||
{
|
{
|
||||||
Con::evaluatef(acc.cmd);
|
Con::evaluatef(acc.cmd);
|
||||||
|
|
@ -145,7 +145,11 @@ void WindowInputGenerator::handleMouseMove( WindowId did, U32 modifier, S32 x, S
|
||||||
event.deviceType = MouseDeviceType;
|
event.deviceType = MouseDeviceType;
|
||||||
event.deviceInst = 0;
|
event.deviceInst = 0;
|
||||||
event.objType = SI_AXIS;
|
event.objType = SI_AXIS;
|
||||||
event.modifier = convertModifierBits(modifier);
|
#ifdef TORQUE_SDL
|
||||||
|
event.modifier = modifier;
|
||||||
|
#else
|
||||||
|
event.modifier = convertModifierBits(modifier);
|
||||||
|
#endif
|
||||||
event.ascii = 0;
|
event.ascii = 0;
|
||||||
|
|
||||||
// Generate delta movement along each axis
|
// Generate delta movement along each axis
|
||||||
|
|
@ -231,7 +235,11 @@ void WindowInputGenerator::handleMouseButton( WindowId did, U32 modifiers, U32 a
|
||||||
event.deviceInst = 0;
|
event.deviceInst = 0;
|
||||||
event.objType = SI_BUTTON;
|
event.objType = SI_BUTTON;
|
||||||
event.objInst = (InputObjectInstances)(KEY_BUTTON0 + button);
|
event.objInst = (InputObjectInstances)(KEY_BUTTON0 + button);
|
||||||
event.modifier = convertModifierBits(modifiers);
|
#ifdef TORQUE_SDL
|
||||||
|
event.modifier = modifiers;
|
||||||
|
#else
|
||||||
|
event.modifier = convertModifierBits(modifiers);
|
||||||
|
#endif
|
||||||
event.ascii = 0;
|
event.ascii = 0;
|
||||||
event.action = (action==IA_MAKE) ? SI_MAKE : SI_BREAK;
|
event.action = (action==IA_MAKE) ? SI_MAKE : SI_BREAK;
|
||||||
event.fValue = (action==IA_MAKE) ? 1.0 : 0.0;
|
event.fValue = (action==IA_MAKE) ? 1.0 : 0.0;
|
||||||
|
|
@ -248,7 +256,11 @@ void WindowInputGenerator::handleMouseWheel( WindowId did, U32 modifiers, S32 wh
|
||||||
event.deviceType = MouseDeviceType;
|
event.deviceType = MouseDeviceType;
|
||||||
event.deviceInst = 0;
|
event.deviceInst = 0;
|
||||||
event.objType = SI_AXIS;
|
event.objType = SI_AXIS;
|
||||||
event.modifier = convertModifierBits(modifiers);
|
#ifdef TORQUE_SDL
|
||||||
|
event.modifier = modifiers;
|
||||||
|
#else
|
||||||
|
event.modifier = convertModifierBits(modifiers);
|
||||||
|
#endif
|
||||||
event.ascii = 0;
|
event.ascii = 0;
|
||||||
event.action = SI_MOVE;
|
event.action = SI_MOVE;
|
||||||
|
|
||||||
|
|
@ -281,7 +293,11 @@ void WindowInputGenerator::handleCharInput( WindowId did, U32 modifier, U16 key
|
||||||
event.deviceInst = 0;
|
event.deviceInst = 0;
|
||||||
event.objType = SI_KEY;
|
event.objType = SI_KEY;
|
||||||
event.objInst = KEY_NULL;
|
event.objInst = KEY_NULL;
|
||||||
event.modifier = convertModifierBits(modifier);
|
#ifdef TORQUE_SDL
|
||||||
|
event.modifier = modifier;
|
||||||
|
#else
|
||||||
|
event.modifier = convertModifierBits(modifier);
|
||||||
|
#endif
|
||||||
event.ascii = key;
|
event.ascii = key;
|
||||||
event.action = SI_MAKE;
|
event.action = SI_MAKE;
|
||||||
event.fValue = 1.0;
|
event.fValue = 1.0;
|
||||||
|
|
@ -303,7 +319,11 @@ void WindowInputGenerator::handleKeyboard( WindowId did, U32 modifier, U32 actio
|
||||||
event.deviceInst = 0;
|
event.deviceInst = 0;
|
||||||
event.objType = SI_KEY;
|
event.objType = SI_KEY;
|
||||||
event.objInst = (InputObjectInstances)key;
|
event.objInst = (InputObjectInstances)key;
|
||||||
event.modifier = convertModifierBits(modifier);
|
#ifdef TORQUE_SDL
|
||||||
|
event.modifier = modifier;
|
||||||
|
#else
|
||||||
|
event.modifier = convertModifierBits(modifier);
|
||||||
|
#endif
|
||||||
event.ascii = 0;
|
event.ascii = 0;
|
||||||
|
|
||||||
switch(action)
|
switch(action)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue