1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-04 00:41:34 +00:00

Don't pass key to input binder if it was consumed by text editor (Fixes #1845)

This commit is contained in:
scrawl 2014-08-25 18:55:21 +02:00
parent dcddd9a07c
commit dd77954512

View file

@ -542,12 +542,15 @@ namespace MWInput
OIS::KeyCode kc = mInputManager->sdl2OISKeyCode(arg.keysym.sym); OIS::KeyCode kc = mInputManager->sdl2OISKeyCode(arg.keysym.sym);
bool consumed = false;
if (kc != OIS::KC_UNASSIGNED) 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); bool guiFocus = MyGUI::InputManager::getInstance().injectKeyPress(MyGUI::KeyCode::Enum(kc), 0);
setPlayerControlsEnabled(!guiFocus); setPlayerControlsEnabled(!guiFocus);
} }
if (!mControlsDisabled) if (!mControlsDisabled && !consumed)
mInputBinder->keyPressed (arg); mInputBinder->keyPressed (arg);
// Clear MyGUI's clipboard, so it doesn't interfere with our own clipboard implementation. // Clear MyGUI's clipboard, so it doesn't interfere with our own clipboard implementation.
@ -808,8 +811,7 @@ namespace MWInput
return; return;
if(MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Journal if(MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Journal
&& MWBase::Environment::get().getWindowManager ()->getJournalAllowed() && MWBase::Environment::get().getWindowManager ()->getJournalAllowed())
&& MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Console)
{ {
MWBase::Environment::get().getSoundManager()->playSound ("book open", 1.0, 1.0); MWBase::Environment::get().getSoundManager()->playSound ("book open", 1.0, 1.0);
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Journal); MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Journal);