From fc48c24c6d366e165cbcfbd022d9421790089890 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sun, 6 Dec 2009 13:01:16 -0700 Subject: 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). --- src/gui/charselectdialog.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/gui/charselectdialog.cpp') diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 43537ca3..4f3619ae 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -34,6 +34,7 @@ #include "gui/confirmdialog.h" #include "gui/okdialog.h" #include "gui/playerbox.h" +#include "gui/sdlinput.h" #include "gui/unregisterdialog.h" #include "game.h" @@ -162,6 +163,8 @@ CharSelectDialog::CharSelectDialog(LockedArray *charInfo, reflowLayout(); + addKeyListener(this); + center(); mCharEntries[0]->requestFocus(); setVisible(true); @@ -217,6 +220,16 @@ void CharSelectDialog::action(const gcn::ActionEvent &event) } } +void CharSelectDialog::keyPressed(gcn::KeyEvent &keyEvent) +{ + gcn::Key key = keyEvent.getKey(); + + if (key.getValue() == Key::ESCAPE) + { + action(gcn::ActionEvent(NULL, mSwitchLoginButton->getActionEventId())); + } +} + void CharSelectDialog::attemptCharDelete() { mCharHandler->deleteCharacter(mCharInfo->getPos(), mCharInfo->getEntry()); -- cgit v1.2.3-70-g09d2