From fc95a45cb6bb8342bc9ef31843362a840b7970e4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 5 Mar 2017 13:58:22 +0100 Subject: [PATCH] Don't pass repeat key events to the viewer's eventQueue --- components/sdlutil/sdlinputwrapper.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/components/sdlutil/sdlinputwrapper.cpp b/components/sdlutil/sdlinputwrapper.cpp index bc7c0d78a..a1c5e42b1 100644 --- a/components/sdlutil/sdlinputwrapper.cpp +++ b/components/sdlutil/sdlinputwrapper.cpp @@ -87,18 +87,24 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr v break; case SDL_KEYDOWN: if (!evt.key.repeat) + { mKeyboardListener->keyPressed(evt.key); - 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)); + 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)); + } + } break; case SDL_KEYUP: if (!evt.key.repeat) + { mKeyboardListener->keyReleased(evt.key); - 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)); + 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)); + } break; case SDL_TEXTEDITING: