From dd77954512f068314dfd22d2a35dc6491c186b2d Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 25 Aug 2014 18:55:21 +0200 Subject: [PATCH] Don't pass key to input binder if it was consumed by text editor (Fixes #1845) --- apps/openmw/mwinput/inputmanagerimp.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 7f81d7fcc..132ed3326 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -542,12 +542,15 @@ namespace MWInput OIS::KeyCode kc = mInputManager->sdl2OISKeyCode(arg.keysym.sym); + bool consumed = false; if (kc != OIS::KC_UNASSIGNED) { + consumed = SDL_IsTextInputActive() && + ( !(SDLK_SCANCODE_MASK & arg.keysym.sym) && std::isprint(arg.keysym.sym)); // Little trick to check if key is printable bool guiFocus = MyGUI::InputManager::getInstance().injectKeyPress(MyGUI::KeyCode::Enum(kc), 0); setPlayerControlsEnabled(!guiFocus); } - if (!mControlsDisabled) + if (!mControlsDisabled && !consumed) mInputBinder->keyPressed (arg); // Clear MyGUI's clipboard, so it doesn't interfere with our own clipboard implementation. @@ -808,8 +811,7 @@ namespace MWInput return; if(MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Journal - && MWBase::Environment::get().getWindowManager ()->getJournalAllowed() - && MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Console) + && MWBase::Environment::get().getWindowManager ()->getJournalAllowed()) { MWBase::Environment::get().getSoundManager()->playSound ("book open", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Journal);