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:
parent
dcddd9a07c
commit
dd77954512
1 changed files with 5 additions and 3 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue