diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-12-06 13:01:16 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-12-06 13:01:16 -0700 |
commit | fc48c24c6d366e165cbcfbd022d9421790089890 (patch) | |
tree | ed264bca67ac2380f787765980ba1897ab43a93a /src/gui/login.cpp | |
parent | c0e6ef1dd4941d689ea723542c4218179d688c7f (diff) | |
download | mana-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/login.cpp')
-rw-r--r-- | src/gui/login.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gui/login.cpp b/src/gui/login.cpp index aa14b00e..396c5d1a 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -22,6 +22,7 @@ #include "gui/login.h" #include "gui/okdialog.h" +#include "gui/sdlinput.h" #include "gui/widgets/button.h" #include "gui/widgets/checkbox.h" @@ -77,6 +78,8 @@ LoginDialog::LoginDialog(LoginData *loginData): place(3, 6, mLoginButton); reflowLayout(250, 0); + addKeyListener(this); + center(); setVisible(true); @@ -121,7 +124,20 @@ void LoginDialog::action(const gcn::ActionEvent &event) void LoginDialog::keyPressed(gcn::KeyEvent &keyEvent) { - mLoginButton->setEnabled(canSubmit()); + gcn::Key key = keyEvent.getKey(); + + if (key.getValue() == Key::ESCAPE) + { + action(gcn::ActionEvent(NULL, mServerButton->getActionEventId())); + } + else if (key.getValue() == Key::ENTER) + { + action(gcn::ActionEvent(NULL, mLoginButton->getActionEventId())); + } + else + { + mLoginButton->setEnabled(canSubmit()); + } } bool LoginDialog::canSubmit() |