From b52df83d8461978478df3899fd537590e65baabd Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 17 Feb 2013 20:23:22 +0100 Subject: [PATCH] Pressing Enter should skip _one_ message box, not skip all message boxes until the key is released again --- apps/openmw/mwinput/inputmanagerimp.cpp | 17 +++++++---------- apps/openmw/mwinput/inputmanagerimp.hpp | 2 -- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index dc4c020d6..f1f88b9ae 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -51,7 +51,6 @@ namespace MWInput , mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input")) , mPreviewPOVDelay(0.f) , mTimeIdle(0.f) - , mEnterPressed(false) { Ogre::RenderWindow* window = ogre.getWindow (); size_t windowHnd; @@ -240,10 +239,6 @@ namespace MWInput void InputManager::update(float dt, bool loading) { - // Pressing enter when a messagebox is prompting for "ok" will activate the ok button - if(mEnterPressed && MWBase::Environment::get().getWindowManager()->isGuiMode() && MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_InterMessageBox) - MWBase::Environment::get().getWindowManager()->enterPressed(); - // Tell OIS to handle all input events mKeyboard->capture(); mMouse->capture(); @@ -431,8 +426,13 @@ namespace MWInput bool InputManager::keyPressed( const OIS::KeyEvent &arg ) { - if(arg.key == OIS::KC_RETURN && MWBase::Environment::get().getWindowManager()->isGuiMode() && MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Console) - mEnterPressed = true; + if(arg.key == OIS::KC_RETURN + && MWBase::Environment::get().getWindowManager()->isGuiMode() + && MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_InterMessageBox ) + { + // Pressing enter when a messagebox is prompting for "ok" will activate the ok button + MWBase::Environment::get().getWindowManager()->enterPressed(); + } mInputCtrl->keyPressed (arg); unsigned int text = arg.text; @@ -450,9 +450,6 @@ namespace MWInput bool InputManager::keyReleased( const OIS::KeyEvent &arg ) { - if(arg.key == OIS::KC_RETURN) - mEnterPressed = false; - mInputCtrl->keyReleased (arg); MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(arg.key)); diff --git a/apps/openmw/mwinput/inputmanagerimp.hpp b/apps/openmw/mwinput/inputmanagerimp.hpp index c7ba7b756..9deed1f28 100644 --- a/apps/openmw/mwinput/inputmanagerimp.hpp +++ b/apps/openmw/mwinput/inputmanagerimp.hpp @@ -151,8 +151,6 @@ namespace MWInput std::map mControlSwitch; - bool mEnterPressed; - private: void adjustMouseRegion(int width, int height);