diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-20 02:11:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-20 02:11:27 +0300 |
commit | 5d4b554617269cc34e894f98134ffa1f92dfd8ba (patch) | |
tree | 078221956831b432630781b0b4d70f8271c8821e /src/gui | |
parent | 848b3f022dac89ac5d2ac932759f5b2f30a090e4 (diff) | |
download | mv-5d4b554617269cc34e894f98134ffa1f92dfd8ba.tar.gz mv-5d4b554617269cc34e894f98134ffa1f92dfd8ba.tar.bz2 mv-5d4b554617269cc34e894f98134ffa1f92dfd8ba.tar.xz mv-5d4b554617269cc34e894f98134ffa1f92dfd8ba.zip |
Improve in servers dialog keyboard handling.
Diffstat (limited to 'src/gui')
-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 &) |