mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 18:32:36 +00:00
Disable repeating for ENTER key in GUI
This commit is contained in:
parent
33a66b778f
commit
269ef7a559
@ -351,6 +351,7 @@ namespace MWBase
|
||||
virtual const MWGui::TextColours& getTextColours() = 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)
|
||||
{
|
||||
onCreateButtonClicked(sender);
|
||||
|
||||
// To do not spam onAccept() again and again
|
||||
MWBase::Environment::get().getWindowManager()->injectKeyRelease(MyGUI::KeyCode::None);
|
||||
}
|
||||
|
||||
void AlchemyWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||
|
@ -73,8 +73,10 @@ namespace MWGui
|
||||
void CountDialog::onEnterKeyPressed(MyGUI::EditBox* _sender)
|
||||
{
|
||||
eventOkClicked(NULL, mSlider->getScrollPosition()+1);
|
||||
|
||||
setVisible(false);
|
||||
|
||||
// To do not spam onEnterKeyPressed() again and again
|
||||
MWBase::Environment::get().getWindowManager()->injectKeyRelease(MyGUI::KeyCode::None);
|
||||
}
|
||||
|
||||
void CountDialog::onEditValueChanged(int value)
|
||||
|
@ -288,6 +288,9 @@ namespace MWGui
|
||||
void EnchantingDialog::onAccept(MyGUI::EditBox *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)
|
||||
|
@ -193,8 +193,10 @@ bool KeyboardNavigation::injectKeyPress(MyGUI::KeyCode key, unsigned int text, b
|
||||
case MyGUI::KeyCode::NumpadEnter:
|
||||
case MyGUI::KeyCode::Space:
|
||||
{
|
||||
// We should disable repeating for activation keys
|
||||
MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::None);
|
||||
if (repeat)
|
||||
return false;
|
||||
return true;
|
||||
|
||||
return accept();
|
||||
}
|
||||
|
@ -127,6 +127,9 @@ namespace MWGui
|
||||
void SaveGameDialog::onEditSelectAccept(MyGUI::EditBox *sender)
|
||||
{
|
||||
accept();
|
||||
|
||||
// To do not spam onEditSelectAccept() again and again
|
||||
MWBase::Environment::get().getWindowManager()->injectKeyRelease(MyGUI::KeyCode::None);
|
||||
}
|
||||
|
||||
void SaveGameDialog::onOpen()
|
||||
|
@ -420,6 +420,9 @@ namespace MWGui
|
||||
void SpellCreationDialog::onAccept(MyGUI::EditBox *sender)
|
||||
{
|
||||
onBuyButtonClicked(sender);
|
||||
|
||||
// To do not spam onAccept() again and again
|
||||
MWBase::Environment::get().getWindowManager()->injectKeyRelease(MyGUI::KeyCode::None);
|
||||
}
|
||||
|
||||
void SpellCreationDialog::onOpen()
|
||||
|
@ -65,6 +65,9 @@ namespace MWGui
|
||||
void TextInputDialog::onTextAccepted(MyGUI::Edit* _sender)
|
||||
{
|
||||
onOkClicked(_sender);
|
||||
|
||||
// To do not spam onTextAccepted() again and again
|
||||
MWBase::Environment::get().getWindowManager()->injectKeyRelease(MyGUI::KeyCode::None);
|
||||
}
|
||||
|
||||
std::string TextInputDialog::getTextInput() const
|
||||
|
@ -367,6 +367,9 @@ namespace MWGui
|
||||
void TradeWindow::onAccept(MyGUI::EditBox *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)
|
||||
|
@ -2091,6 +2091,11 @@ namespace MWGui
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WindowManager::injectKeyRelease(MyGUI::KeyCode key)
|
||||
{
|
||||
return MyGUI::InputManager::getInstance().injectKeyRelease(key);
|
||||
}
|
||||
|
||||
void WindowManager::GuiModeState::update(bool visible)
|
||||
{
|
||||
for (unsigned int i=0; i<mWindows.size(); ++i)
|
||||
|
@ -380,6 +380,7 @@ namespace MWGui
|
||||
virtual const MWGui::TextColours& getTextColours();
|
||||
|
||||
virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text, bool repeat=false);
|
||||
virtual bool injectKeyRelease(MyGUI::KeyCode key);
|
||||
|
||||
private:
|
||||
const MWWorld::ESMStore* mStore;
|
||||
|
Loading…
x
Reference in New Issue
Block a user