From 5d4b554617269cc34e894f98134ffa1f92dfd8ba Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 20 Apr 2012 02:11:27 +0300 Subject: Improve in servers dialog keyboard handling. --- src/gui/serverdialog.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'src/gui') 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)->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)->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 &) -- cgit v1.2.3-70-g09d2