mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-31 04:25:40 +00:00
Fixed a few issues where text editing was not stopped when leaving the text edit popup dialogs
This commit is contained in:
parent
a8f93cb2bb
commit
2e5f56970a
|
@ -130,6 +130,9 @@ std::string TextEditComponent::getValue() const
|
|||
|
||||
void TextEditComponent::startEditing()
|
||||
{
|
||||
if (mEditing)
|
||||
return;
|
||||
|
||||
SDL_StartTextInput();
|
||||
mEditing = true;
|
||||
updateHelpPrompts();
|
||||
|
@ -138,6 +141,9 @@ void TextEditComponent::startEditing()
|
|||
|
||||
void TextEditComponent::stopEditing()
|
||||
{
|
||||
if (!mEditing)
|
||||
return;
|
||||
|
||||
SDL_StopTextInput();
|
||||
mEditing = false;
|
||||
mMaskInput = false;
|
||||
|
@ -215,7 +221,7 @@ bool TextEditComponent::input(InputConfig* config, Input input)
|
|||
moveCursor(mCursorRepeatDir);
|
||||
return false;
|
||||
}
|
||||
else if (cursorDown) {
|
||||
else if (cursorDown && isEditing()) {
|
||||
// Stop editing and let the button down event be captured by the parent component.
|
||||
stopEditing();
|
||||
return false;
|
||||
|
@ -238,6 +244,9 @@ bool TextEditComponent::input(InputConfig* config, Input input)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (config->isMappedTo("b", input))
|
||||
stopEditing();
|
||||
|
||||
// Consume all input when editing text.
|
||||
mMaskInput = false;
|
||||
return true;
|
||||
|
|
|
@ -378,15 +378,15 @@ bool GuiTextEditKeyboardPopup::input(InputConfig* config, Input input)
|
|||
"", nullptr, nullptr, true));
|
||||
}
|
||||
else {
|
||||
if (mText->isEditing())
|
||||
mText->stopEditing();
|
||||
delete this;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (mText->isEditing() && config->isMappedLike("down", input) && input.value) {
|
||||
mText->stopEditing();
|
||||
if (mText->isEditing() && config->isMappedLike("down", input) && input.value)
|
||||
mGrid.setCursorTo(mGrid.getSelectedComponent());
|
||||
}
|
||||
|
||||
// Left trigger button outside text editing field toggles Shift key.
|
||||
if (!mText->isEditing() && config->isMappedLike("lefttrigger", input) && input.value)
|
||||
|
|
|
@ -205,15 +205,15 @@ bool GuiTextEditPopup::input(InputConfig* config, Input input)
|
|||
"", nullptr, nullptr, true));
|
||||
}
|
||||
else {
|
||||
if (mText->isEditing())
|
||||
mText->stopEditing();
|
||||
delete this;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (mText->isEditing() && config->isMappedLike("down", input) && input.value) {
|
||||
mText->stopEditing();
|
||||
if (mText->isEditing() && config->isMappedLike("down", input) && input.value)
|
||||
mGrid.setCursorTo(mGrid.getSelectedComponent());
|
||||
}
|
||||
|
||||
// Left shoulder button deletes a character (backspace).
|
||||
if (config->isMappedTo("leftshoulder", input)) {
|
||||
|
|
Loading…
Reference in a new issue