mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-04 02:41:19 +00:00
Don't pass key events to the viewer when Alt modifier is held
Fixes the stats panel briefly showing up when using 'Alt+F4' to exit.
This commit is contained in:
parent
fc95a45cb6
commit
21aad00612
@ -90,7 +90,7 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> v
|
||||
{
|
||||
mKeyboardListener->keyPressed(evt.key);
|
||||
|
||||
if (evt.key.keysym.sym >= SDLK_F1 && evt.key.keysym.sym <= SDLK_F12)
|
||||
if (!isModifierHeld(KMOD_ALT) && evt.key.keysym.sym >= SDLK_F1 && evt.key.keysym.sym <= SDLK_F12)
|
||||
{
|
||||
mViewer->getEventQueue()->keyPress(osgGA::GUIEventAdapter::KEY_F1 + (evt.key.keysym.sym - SDLK_F1));
|
||||
}
|
||||
@ -102,7 +102,7 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> v
|
||||
{
|
||||
mKeyboardListener->keyReleased(evt.key);
|
||||
|
||||
if (evt.key.keysym.sym >= SDLK_F1 && evt.key.keysym.sym <= SDLK_F12)
|
||||
if (!isModifierHeld(KMOD_ALT) && evt.key.keysym.sym >= SDLK_F1 && evt.key.keysym.sym <= SDLK_F12)
|
||||
mViewer->getEventQueue()->keyRelease(osgGA::GUIEventAdapter::KEY_F1 + (evt.key.keysym.sym - SDLK_F1));
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> v
|
||||
}
|
||||
}
|
||||
|
||||
bool InputWrapper::isModifierHeld(SDL_Keymod mod)
|
||||
bool InputWrapper::isModifierHeld(int mod)
|
||||
{
|
||||
return (SDL_GetModState() & mod) != 0;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace SDLUtil
|
||||
void setControllerEventCallback(ControllerListener* listen) { mConListener = listen; }
|
||||
|
||||
void capture(bool windowEventsOnly);
|
||||
bool isModifierHeld(SDL_Keymod mod);
|
||||
bool isModifierHeld(int mod);
|
||||
bool isKeyDown(SDL_Scancode key);
|
||||
|
||||
void setMouseVisible (bool visible);
|
||||
|
Loading…
Reference in New Issue
Block a user