Disable repeating for Accept action in keyboard navigation (bug #4260)

pull/1915/head
Andrei Kortunov 6 years ago
parent 778dfa0350
commit 33a66b778f

@ -45,6 +45,7 @@
Bug #4230: AiTravel package issues break some Tribunal quests
Bug #4231: Infected rats from the "Crimson Plague" quest rendered unconscious by change in Drain Fatigue functionality
Bug #4251: Stationary NPCs do not return to their position after combat
Bug #4260: Keyboard navigation makes persuasion exploitable
Bug #4271: Scamp flickers when attacking
Bug #4274: Pre-0.43 death animations are not forward-compatible with 0.43+
Bug #4286: Scripted animations can be interrupted

@ -350,7 +350,7 @@ namespace MWBase
virtual const MWGui::TextColours& getTextColours() = 0;
virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text) = 0;
virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text, bool repeat) = 0;
};
}

@ -172,7 +172,7 @@ enum Direction
D_Prev
};
bool KeyboardNavigation::injectKeyPress(MyGUI::KeyCode key, unsigned int text)
bool KeyboardNavigation::injectKeyPress(MyGUI::KeyCode key, unsigned int text, bool repeat)
{
if (!mEnabled)
return false;
@ -192,7 +192,12 @@ bool KeyboardNavigation::injectKeyPress(MyGUI::KeyCode key, unsigned int text)
case MyGUI::KeyCode::Return:
case MyGUI::KeyCode::NumpadEnter:
case MyGUI::KeyCode::Space:
{
if (repeat)
return false;
return accept();
}
default:
return false;
}

@ -14,7 +14,7 @@ namespace MWGui
~KeyboardNavigation();
/// @return Was the key handled by this class?
bool injectKeyPress(MyGUI::KeyCode key, unsigned int text);
bool injectKeyPress(MyGUI::KeyCode key, unsigned int text, bool repeat);
void saveFocus(int mode);
void restoreFocus(int mode);

@ -2060,9 +2060,9 @@ namespace MWGui
return mTextColours;
}
bool WindowManager::injectKeyPress(MyGUI::KeyCode key, unsigned int text)
bool WindowManager::injectKeyPress(MyGUI::KeyCode key, unsigned int text, bool repeat)
{
if (!mKeyboardNavigation->injectKeyPress(key, text))
if (!mKeyboardNavigation->injectKeyPress(key, text, repeat))
{
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
bool widgetActive = MyGUI::InputManager::getInstance().injectKeyPress(key, text);

@ -379,7 +379,7 @@ namespace MWGui
virtual const MWGui::TextColours& getTextColours();
virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text);
virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text, bool repeat=false);
private:
const MWWorld::ESMStore* mStore;

@ -214,7 +214,7 @@ namespace MWInput
break;
}
MWBase::Environment::get().getWindowManager()->injectKeyPress(key, 0);
MWBase::Environment::get().getWindowManager()->injectKeyPress(key, 0, false);
}
void InputManager::channelChanged(ICS::Channel* channel, float currentValue, float previousValue)
@ -720,7 +720,7 @@ namespace MWInput
bool consumed = false;
if (kc != OIS::KC_UNASSIGNED && !mInputBinder->detectingBindingState())
{
consumed = MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::Enum(kc), 0);
consumed = MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::Enum(kc), 0, arg.repeat);
if (SDL_IsTextInputActive() && // Little trick to check if key is printable
( !(SDLK_SCANCODE_MASK & arg.keysym.sym) && std::isprint(arg.keysym.sym)))
consumed = true;
@ -1153,7 +1153,7 @@ namespace MWInput
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
{
if (!SDL_IsTextInputActive() && !isLeftOrRightButton(A_Activate, mInputBinder, mFakeDeviceID, mJoystickLastUsed))
MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::Return, 0);
MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::Return, 0, false);
}
else if (mControlSwitch["playercontrols"])
mPlayer->activate();

Loading…
Cancel
Save