Pass repeat key events to the GUI

For example, one can scroll to the last element in a list by holding down the 'Down Arrow' key.
new-script-api
scrawl 7 years ago
parent b22fedf4ae
commit e7ad012977

@ -679,6 +679,9 @@ namespace MWInput
bool guiFocus = MyGUI::InputManager::getInstance().injectKeyPress(MyGUI::KeyCode::Enum(kc), 0);
setPlayerControlsEnabled(!guiFocus);
}
if (arg.repeat)
return;
if (!mControlsDisabled && !consumed)
mInputBinder->keyPressed (arg);
mJoystickLastUsed = false;

@ -85,14 +85,11 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> v
mMouseListener->mouseReleased(evt.button, evt.button.button);
break;
case SDL_KEYDOWN:
if (!evt.key.repeat)
{
mKeyboardListener->keyPressed(evt.key);
mKeyboardListener->keyPressed(evt.key);
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));
}
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));
}
break;

Loading…
Cancel
Save