summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-20 02:11:27 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-20 02:11:27 +0300
commit5d4b554617269cc34e894f98134ffa1f92dfd8ba (patch)
tree078221956831b432630781b0b4d70f8271c8821e
parent848b3f022dac89ac5d2ac932759f5b2f30a090e4 (diff)
downloadmanaverse-5d4b554617269cc34e894f98134ffa1f92dfd8ba.tar.gz
manaverse-5d4b554617269cc34e894f98134ffa1f92dfd8ba.tar.bz2
manaverse-5d4b554617269cc34e894f98134ffa1f92dfd8ba.tar.xz
manaverse-5d4b554617269cc34e894f98134ffa1f92dfd8ba.zip
Improve in servers dialog keyboard handling.
-rw-r--r--src/gui/serverdialog.cpp25
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 &)