summaryrefslogtreecommitdiff
path: root/src/input/inputmanager.cpp
diff options
context:
space:
mode:
authorewewukek <ewewukek@gmail.com>2024-04-02 08:18:17 +0300
committerFedja Beader <fedja@protonmail.ch>2024-05-15 00:11:38 +0200
commit16fafb1516a346ee0553a329b0606c2bb55283d7 (patch)
tree653360810d5c394e3457a4c6f8a236e69fa2618b /src/input/inputmanager.cpp
parent4c6d99ef4e393f900c4acf521a376f6ea0e012f6 (diff)
downloadplus-16fafb1516a346ee0553a329b0606c2bb55283d7.tar.gz
plus-16fafb1516a346ee0553a329b0606c2bb55283d7.tar.bz2
plus-16fafb1516a346ee0553a329b0606c2bb55283d7.tar.xz
plus-16fafb1516a346ee0553a329b0606c2bb55283d7.zip
Consume input event in QuitDialog instead of relying on a hack
Diffstat (limited to 'src/input/inputmanager.cpp')
-rw-r--r--src/input/inputmanager.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp
index fc2815b5e..8cb10041e 100644
--- a/src/input/inputmanager.cpp
+++ b/src/input/inputmanager.cpp
@@ -691,21 +691,7 @@ bool InputManager::handleEvent(const SDL_Event &restrict event) restrict2
BLOCK_END("InputManager::handleEvent")
return true;
}
-
keyboard.handleActivateKey(event);
- // send straight to gui for certain windows
-#ifndef DYECMD
- if ((quitDialog != nullptr) || TextDialog::isActive())
- {
- if (guiInput != nullptr)
- guiInput->pushInput(event);
- if (gui != nullptr)
- gui->handleInput();
- BLOCK_END("InputManager::handleEvent")
- return true;
- }
-#endif // DYECMD
-
break;
}
case SDL_KEYUP:
@@ -767,9 +753,15 @@ bool InputManager::handleEvent(const SDL_Event &restrict event) restrict2
guiInput->pushInput(event);
if (gui != nullptr)
{
- const bool res = gui->handleInput();
+ bool res = gui->handleInput();
+#ifndef DYECMD
+ // always treat keyboard input as handled if a text dialog is active
+ if (event.type == SDL_KEYDOWN && TextDialog::isActive())
+ res = true;
+#endif // DYECMD
const bool joystickActionEvent =
joystick != nullptr && joystick->isActionEvent(event);
+ // stop processing input if event is consumed by the gui
if (res && (event.type == SDL_KEYDOWN || joystickActionEvent))
{
BLOCK_END("InputManager::handleEvent")