summaryrefslogtreecommitdiff
path: root/src/gui/updatewindow.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-12-06 13:01:16 -0700
committerJared Adams <jaxad0127@gmail.com>2009-12-06 13:01:16 -0700
commitfc48c24c6d366e165cbcfbd022d9421790089890 (patch)
treeed264bca67ac2380f787765980ba1897ab43a93a /src/gui/updatewindow.cpp
parentc0e6ef1dd4941d689ea723542c4218179d688c7f (diff)
downloadmana-fc48c24c6d366e165cbcfbd022d9421790089890.tar.gz
mana-fc48c24c6d366e165cbcfbd022d9421790089890.tar.bz2
mana-fc48c24c6d366e165cbcfbd022d9421790089890.tar.xz
mana-fc48c24c6d366e165cbcfbd022d9421790089890.zip
Improve keyboard accessibility of login sequence
Enter and Escape now move forward and backwards for all dialogs except ServerSelectDialog (Escape quits) and CharSelectDialog (Enter doesn't do anything special).
Diffstat (limited to 'src/gui/updatewindow.cpp')
-rw-r--r--src/gui/updatewindow.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 801bd161..afb87430 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -28,6 +28,8 @@
#include "gui/widgets/progressbar.h"
#include "gui/widgets/scrollarea.h"
+#include "gui/sdlinput.h"
+
#include "configuration.h"
#include "log.h"
#include "main.h"
@@ -105,6 +107,8 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost,
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
+ addKeyListener(this);
+
center();
setVisible(true);
mCancelButton->requestFocus();
@@ -162,6 +166,29 @@ void UpdaterWindow::action(const gcn::ActionEvent &event)
}
}
+void UpdaterWindow::keyPressed(gcn::KeyEvent &keyEvent)
+{
+ gcn::Key key = keyEvent.getKey();
+
+ if (key.getValue() == Key::ESCAPE)
+ {
+ action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId()));
+ state = STATE_WORLD_SELECT;
+ }
+ else if (key.getValue() == Key::ENTER)
+ {
+ if (mDownloadStatus == UPDATE_COMPLETE ||
+ mDownloadStatus == UPDATE_ERROR)
+ {
+ action(gcn::ActionEvent(NULL, mPlayButton->getActionEventId()));
+ }
+ else
+ {
+ action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId()));
+ }
+ }
+}
+
void UpdaterWindow::loadNews()
{
if (!mMemoryBuffer)