summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorewew ukek <ewewukek@gmail.com>2024-04-07 15:51:18 +0000
committerFedja Beader <fedja@protonmail.ch>2024-04-07 15:51:18 +0000
commitcbab9d6d4c3a38ece9bd97ac866b28c4d83ecc1a (patch)
treecbc06965f688b9ae1b3ee840cf96cca840d5ff69 /src/gui
parent718e5611b6f915cb3a11375dfb0e463ac67c5ede (diff)
downloadmanaverse-cbab9d6d4c3a38ece9bd97ac866b28c4d83ecc1a.tar.gz
manaverse-cbab9d6d4c3a38ece9bd97ac866b28c4d83ecc1a.tar.bz2
manaverse-cbab9d6d4c3a38ece9bd97ac866b28c4d83ecc1a.tar.xz
manaverse-cbab9d6d4c3a38ece9bd97ac866b28c4d83ecc1a.zip
Fix for login button
This is the simpler solution for issue #64 proposed by @bjorn. `logic()` gets called on every tick after input is processed so I removed redundant code from `keyPressed()`. * Update login button in logic() instead of keyPressed() See merge request mana/plus!67 **** Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/windows/logindialog.cpp16
-rw-r--r--src/gui/windows/logindialog.h2
2 files changed, 8 insertions, 10 deletions
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index 3facc7030..96f371660 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -238,6 +238,12 @@ LoginDialog::~LoginDialog()
delete2(mUpdateListModel)
}
+void LoginDialog::logic()
+{
+ mLoginButton->setEnabled(canSubmit());
+ Window::logic();
+}
+
void LoginDialog::action(const ActionEvent &event)
{
const std::string &eventId = event.getId();
@@ -287,12 +293,6 @@ void LoginDialog::action(const ActionEvent &event)
void LoginDialog::keyPressed(KeyEvent &event)
{
- if (event.isConsumed())
- {
- mLoginButton->setEnabled(canSubmit());
- return;
- }
-
const InputActionT actionId = event.getActionId();
if (actionId == InputAction::GUI_CANCEL)
{
@@ -307,10 +307,6 @@ void LoginDialog::keyPressed(KeyEvent &event)
{
action(ActionEvent(nullptr, mLoginButton->getActionEventId()));
}
- else
- {
- mLoginButton->setEnabled(canSubmit());
- }
}
bool LoginDialog::canSubmit() const
diff --git a/src/gui/windows/logindialog.h b/src/gui/windows/logindialog.h
index 4b9fc86db..95e394291 100644
--- a/src/gui/windows/logindialog.h
+++ b/src/gui/windows/logindialog.h
@@ -64,6 +64,8 @@ class LoginDialog final : public Window,
void postInit() override final;
+ void logic() override final;
+
/**
* Called when receiving actions from the widgets.
*/