diff options
-rw-r--r-- | src/gui/serverdialog.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index fa23c95f3..56ff99228 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -399,17 +399,24 @@ void ServerDialog::action(const gcn::ActionEvent &event) void ServerDialog::keyPressed(gcn::KeyEvent &keyEvent) { - int actionId = static_cast<KeyEvent*>(&keyEvent)->getActionId(); - - if (actionId == Input::KEY_GUI_CANCEL) - { - Client::setState(STATE_EXIT); - } - else if (actionId == Input::KEY_GUI_SELECT - || actionId == Input::KEY_GUI_SELECT2) + switch (static_cast<KeyEvent*>(&keyEvent)->getActionId()) { - action(gcn::ActionEvent(nullptr, mConnectButton->getActionEventId())); + case Input::KEY_GUI_CANCEL: + keyEvent.consume(); + Client::setState(STATE_EXIT); + return; + + case Input::KEY_GUI_SELECT: + case Input::KEY_GUI_SELECT2: + keyEvent.consume(); + action(gcn::ActionEvent(nullptr, + mConnectButton->getActionEventId())); + return; + + default: + break; } + mServersList->keyPressed(keyEvent); } void ServerDialog::valueChanged(const gcn::SelectionEvent &) |