mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-06 09:39:49 +00:00
Merge pull request #1915 from akortunov/enterfix
Disable repeating for Accept GUI action
This commit is contained in:
commit
6035636e29
@ -45,6 +45,7 @@
|
|||||||
Bug #4230: AiTravel package issues break some Tribunal quests
|
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 #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 #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 #4271: Scamp flickers when attacking
|
||||||
Bug #4274: Pre-0.43 death animations are not forward-compatible with 0.43+
|
Bug #4274: Pre-0.43 death animations are not forward-compatible with 0.43+
|
||||||
Bug #4286: Scripted animations can be interrupted
|
Bug #4286: Scripted animations can be interrupted
|
||||||
|
@ -350,7 +350,8 @@ namespace MWBase
|
|||||||
|
|
||||||
virtual const MWGui::TextColours& getTextColours() = 0;
|
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;
|
||||||
|
virtual bool injectKeyRelease(MyGUI::KeyCode key) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,9 @@ namespace MWGui
|
|||||||
void AlchemyWindow::onAccept(MyGUI::EditBox* sender)
|
void AlchemyWindow::onAccept(MyGUI::EditBox* sender)
|
||||||
{
|
{
|
||||||
onCreateButtonClicked(sender);
|
onCreateButtonClicked(sender);
|
||||||
|
|
||||||
|
// To do not spam onAccept() again and again
|
||||||
|
MWBase::Environment::get().getWindowManager()->injectKeyRelease(MyGUI::KeyCode::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlchemyWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
void AlchemyWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||||
|
@ -73,8 +73,10 @@ namespace MWGui
|
|||||||
void CountDialog::onEnterKeyPressed(MyGUI::EditBox* _sender)
|
void CountDialog::onEnterKeyPressed(MyGUI::EditBox* _sender)
|
||||||
{
|
{
|
||||||
eventOkClicked(NULL, mSlider->getScrollPosition()+1);
|
eventOkClicked(NULL, mSlider->getScrollPosition()+1);
|
||||||
|
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
|
||||||
|
// To do not spam onEnterKeyPressed() again and again
|
||||||
|
MWBase::Environment::get().getWindowManager()->injectKeyRelease(MyGUI::KeyCode::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountDialog::onEditValueChanged(int value)
|
void CountDialog::onEditValueChanged(int value)
|
||||||
|
@ -288,6 +288,9 @@ namespace MWGui
|
|||||||
void EnchantingDialog::onAccept(MyGUI::EditBox *sender)
|
void EnchantingDialog::onAccept(MyGUI::EditBox *sender)
|
||||||
{
|
{
|
||||||
onBuyButtonClicked(sender);
|
onBuyButtonClicked(sender);
|
||||||
|
|
||||||
|
// To do not spam onAccept() again and again
|
||||||
|
MWBase::Environment::get().getWindowManager()->injectKeyRelease(MyGUI::KeyCode::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnchantingDialog::onBuyButtonClicked(MyGUI::Widget* sender)
|
void EnchantingDialog::onBuyButtonClicked(MyGUI::Widget* sender)
|
||||||
|
@ -181,7 +181,7 @@ enum Direction
|
|||||||
D_Prev
|
D_Prev
|
||||||
};
|
};
|
||||||
|
|
||||||
bool KeyboardNavigation::injectKeyPress(MyGUI::KeyCode key, unsigned int text)
|
bool KeyboardNavigation::injectKeyPress(MyGUI::KeyCode key, unsigned int text, bool repeat)
|
||||||
{
|
{
|
||||||
if (!mEnabled)
|
if (!mEnabled)
|
||||||
return false;
|
return false;
|
||||||
@ -201,7 +201,14 @@ bool KeyboardNavigation::injectKeyPress(MyGUI::KeyCode key, unsigned int text)
|
|||||||
case MyGUI::KeyCode::Return:
|
case MyGUI::KeyCode::Return:
|
||||||
case MyGUI::KeyCode::NumpadEnter:
|
case MyGUI::KeyCode::NumpadEnter:
|
||||||
case MyGUI::KeyCode::Space:
|
case MyGUI::KeyCode::Space:
|
||||||
|
{
|
||||||
|
// We should disable repeating for activation keys
|
||||||
|
MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::None);
|
||||||
|
if (repeat)
|
||||||
|
return true;
|
||||||
|
|
||||||
return accept();
|
return accept();
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ namespace MWGui
|
|||||||
~KeyboardNavigation();
|
~KeyboardNavigation();
|
||||||
|
|
||||||
/// @return Was the key handled by this class?
|
/// @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 saveFocus(int mode);
|
||||||
void restoreFocus(int mode);
|
void restoreFocus(int mode);
|
||||||
|
@ -127,6 +127,9 @@ namespace MWGui
|
|||||||
void SaveGameDialog::onEditSelectAccept(MyGUI::EditBox *sender)
|
void SaveGameDialog::onEditSelectAccept(MyGUI::EditBox *sender)
|
||||||
{
|
{
|
||||||
accept();
|
accept();
|
||||||
|
|
||||||
|
// To do not spam onEditSelectAccept() again and again
|
||||||
|
MWBase::Environment::get().getWindowManager()->injectKeyRelease(MyGUI::KeyCode::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveGameDialog::onOpen()
|
void SaveGameDialog::onOpen()
|
||||||
|
@ -423,6 +423,9 @@ namespace MWGui
|
|||||||
void SpellCreationDialog::onAccept(MyGUI::EditBox *sender)
|
void SpellCreationDialog::onAccept(MyGUI::EditBox *sender)
|
||||||
{
|
{
|
||||||
onBuyButtonClicked(sender);
|
onBuyButtonClicked(sender);
|
||||||
|
|
||||||
|
// To do not spam onAccept() again and again
|
||||||
|
MWBase::Environment::get().getWindowManager()->injectKeyRelease(MyGUI::KeyCode::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellCreationDialog::onOpen()
|
void SpellCreationDialog::onOpen()
|
||||||
|
@ -65,6 +65,9 @@ namespace MWGui
|
|||||||
void TextInputDialog::onTextAccepted(MyGUI::Edit* _sender)
|
void TextInputDialog::onTextAccepted(MyGUI::Edit* _sender)
|
||||||
{
|
{
|
||||||
onOkClicked(_sender);
|
onOkClicked(_sender);
|
||||||
|
|
||||||
|
// To do not spam onTextAccepted() again and again
|
||||||
|
MWBase::Environment::get().getWindowManager()->injectKeyRelease(MyGUI::KeyCode::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TextInputDialog::getTextInput() const
|
std::string TextInputDialog::getTextInput() const
|
||||||
|
@ -367,6 +367,9 @@ namespace MWGui
|
|||||||
void TradeWindow::onAccept(MyGUI::EditBox *sender)
|
void TradeWindow::onAccept(MyGUI::EditBox *sender)
|
||||||
{
|
{
|
||||||
onOfferButtonClicked(sender);
|
onOfferButtonClicked(sender);
|
||||||
|
|
||||||
|
// To do not spam onAccept() again and again
|
||||||
|
MWBase::Environment::get().getWindowManager()->injectKeyRelease(MyGUI::KeyCode::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TradeWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
void TradeWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||||
|
@ -2067,9 +2067,9 @@ namespace MWGui
|
|||||||
return mTextColours;
|
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();
|
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
||||||
bool widgetActive = MyGUI::InputManager::getInstance().injectKeyPress(key, text);
|
bool widgetActive = MyGUI::InputManager::getInstance().injectKeyPress(key, text);
|
||||||
@ -2098,6 +2098,11 @@ namespace MWGui
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WindowManager::injectKeyRelease(MyGUI::KeyCode key)
|
||||||
|
{
|
||||||
|
return MyGUI::InputManager::getInstance().injectKeyRelease(key);
|
||||||
|
}
|
||||||
|
|
||||||
void WindowManager::GuiModeState::update(bool visible)
|
void WindowManager::GuiModeState::update(bool visible)
|
||||||
{
|
{
|
||||||
for (unsigned int i=0; i<mWindows.size(); ++i)
|
for (unsigned int i=0; i<mWindows.size(); ++i)
|
||||||
|
@ -379,7 +379,8 @@ namespace MWGui
|
|||||||
|
|
||||||
virtual const MWGui::TextColours& getTextColours();
|
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);
|
||||||
|
virtual bool injectKeyRelease(MyGUI::KeyCode key);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const MWWorld::ESMStore* mStore;
|
const MWWorld::ESMStore* mStore;
|
||||||
|
@ -214,7 +214,7 @@ namespace MWInput
|
|||||||
break;
|
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)
|
void InputManager::channelChanged(ICS::Channel* channel, float currentValue, float previousValue)
|
||||||
@ -720,7 +720,7 @@ namespace MWInput
|
|||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
if (kc != OIS::KC_UNASSIGNED && !mInputBinder->detectingBindingState())
|
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
|
if (SDL_IsTextInputActive() && // Little trick to check if key is printable
|
||||||
( !(SDLK_SCANCODE_MASK & arg.keysym.sym) && std::isprint(arg.keysym.sym)))
|
( !(SDLK_SCANCODE_MASK & arg.keysym.sym) && std::isprint(arg.keysym.sym)))
|
||||||
consumed = true;
|
consumed = true;
|
||||||
@ -1153,7 +1153,7 @@ namespace MWInput
|
|||||||
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||||
{
|
{
|
||||||
if (!SDL_IsTextInputActive() && !isLeftOrRightButton(A_Activate, mInputBinder, mFakeDeviceID, mJoystickLastUsed))
|
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"])
|
else if (mControlSwitch["playercontrols"])
|
||||||
mPlayer->activate();
|
mPlayer->activate();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user