Don't pass repeat key events to the viewer's eventQueue

pull/183/head
scrawl 8 years ago
parent 70841ea3b7
commit fc95a45cb6

@ -87,18 +87,24 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> v
break; break;
case SDL_KEYDOWN: case SDL_KEYDOWN:
if (!evt.key.repeat) if (!evt.key.repeat)
{
mKeyboardListener->keyPressed(evt.key); mKeyboardListener->keyPressed(evt.key);
if (evt.key.keysym.sym >= SDLK_F1 && evt.key.keysym.sym <= SDLK_F12) if (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)); {
mViewer->getEventQueue()->keyPress(osgGA::GUIEventAdapter::KEY_F1 + (evt.key.keysym.sym - SDLK_F1));
}
}
break; break;
case SDL_KEYUP: case SDL_KEYUP:
if (!evt.key.repeat) if (!evt.key.repeat)
{
mKeyboardListener->keyReleased(evt.key); mKeyboardListener->keyReleased(evt.key);
if (evt.key.keysym.sym >= SDLK_F1 && evt.key.keysym.sym <= SDLK_F12) if (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)); mViewer->getEventQueue()->keyRelease(osgGA::GUIEventAdapter::KEY_F1 + (evt.key.keysym.sym - SDLK_F1));
}
break; break;
case SDL_TEXTEDITING: case SDL_TEXTEDITING:

Loading…
Cancel
Save