summaryrefslogtreecommitdiff
path: root/src/gui/serverdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/serverdialog.cpp')
-rw-r--r--src/gui/serverdialog.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 39c2792f..32e714c6 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -22,6 +22,7 @@
#include "gui/serverdialog.h"
#include "gui/okdialog.h"
+#include "gui/sdlinput.h"
#include "gui/widgets/button.h"
#include "gui/widgets/label.h"
@@ -149,9 +150,10 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir):
// Make sure the list has enough height
getLayout().setRowHeight(3, 80);
-
reflowLayout(300, 0);
+ addKeyListener(this);
+
center();
setFieldsReadOnly(true);
setVisible(true);
@@ -248,6 +250,20 @@ void ServerDialog::action(const gcn::ActionEvent &event)
}
}
+void ServerDialog::keyPressed(gcn::KeyEvent &keyEvent)
+{
+ gcn::Key key = keyEvent.getKey();
+
+ if (key.getValue() == Key::ESCAPE)
+ {
+ state = STATE_EXIT;
+ }
+ else if (key.getValue() == Key::ENTER)
+ {
+ action(gcn::ActionEvent(NULL, mConnectButton->getActionEventId()));
+ }
+}
+
void ServerDialog::valueChanged(const gcn::SelectionEvent &event)
{
const int index = mServersList->getSelected();