diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-10-04 05:59:14 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-10-04 05:59:14 (GMT) |
commit | 22f3df9aa81efc071cb13d43a372ead97548eebc (patch) | |
tree | 7aebd6ceca68ab4b7a723ac4d2370239c59afde1 /src/Keys.cc | |
parent | c91926cf71dcaaea2cf6e56e74b1de50ff17f6f5 (diff) | |
download | fluxbox-22f3df9aa81efc071cb13d43a372ead97548eebc.zip fluxbox-22f3df9aa81efc071cb13d43a372ead97548eebc.tar.bz2 |
break keychains after an invalid key is pressed (which unfortunately will be swallowed)
Diffstat (limited to 'src/Keys.cc')
-rw-r--r-- | src/Keys.cc | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/Keys.cc b/src/Keys.cc index 05f1747..658820e 100644 --- a/src/Keys.cc +++ b/src/Keys.cc | |||
@@ -170,7 +170,9 @@ Keys::t_key::~t_key() { | |||
170 | 170 | ||
171 | 171 | ||
172 | 172 | ||
173 | Keys::Keys(): m_reloader(new FbTk::AutoReloadHelper()), next_key(0) { | 173 | Keys::Keys(): |
174 | m_reloader(new FbTk::AutoReloadHelper()), | ||
175 | next_key(0), saved_keymode(0) { | ||
174 | m_reloader->setReloadCmd(FbTk::RefCount<FbTk::Command<void> >(new FbTk::SimpleCommand<Keys>(*this, &Keys::reload))); | 176 | m_reloader->setReloadCmd(FbTk::RefCount<FbTk::Command<void> >(new FbTk::SimpleCommand<Keys>(*this, &Keys::reload))); |
175 | } | 177 | } |
176 | 178 | ||
@@ -187,6 +189,7 @@ void Keys::deleteTree() { | |||
187 | delete map_it->second; | 189 | delete map_it->second; |
188 | m_map.clear(); | 190 | m_map.clear(); |
189 | next_key = 0; | 191 | next_key = 0; |
192 | saved_keymode = 0; | ||
190 | } | 193 | } |
191 | 194 | ||
192 | // keys are only grabbed in global context | 195 | // keys are only grabbed in global context |
@@ -504,22 +507,16 @@ bool Keys::doAction(int type, unsigned int mods, unsigned int key, | |||
504 | if (!temp_key && isdouble) | 507 | if (!temp_key && isdouble) |
505 | temp_key = next_key->find(type, mods, key, context, false); | 508 | temp_key = next_key->find(type, mods, key, context, false); |
506 | 509 | ||
507 | // need to save this for emacs-style keybindings | ||
508 | static t_key *saved_keymode = 0; | ||
509 | |||
510 | // grab "None Escape" to exit keychain in the middle | ||
511 | unsigned int esc = FbTk::KeyUtil::getKey("Escape"); | ||
512 | |||
513 | if (temp_key && !temp_key->keylist.empty()) { // emacs-style | 510 | if (temp_key && !temp_key->keylist.empty()) { // emacs-style |
514 | if (!saved_keymode) | 511 | if (!saved_keymode) |
515 | saved_keymode = m_keylist; | 512 | saved_keymode = m_keylist; |
516 | next_key = temp_key; | 513 | next_key = temp_key; |
517 | setKeyMode(next_key); | 514 | setKeyMode(next_key); |
518 | grabKey(esc,0); | ||
519 | return true; | 515 | return true; |
520 | } | 516 | } |
521 | if (!temp_key || *temp_key->m_command == 0) { | 517 | if (!temp_key || *temp_key->m_command == 0) { |
522 | if (type == KeyPress && key == esc && mods == 0) { | 518 | if (type == KeyPress && |
519 | !FbTk::KeyUtil::instance().keycodeToModmask(key)) { | ||
523 | // if we're in the middle of an emacs-style keychain, exit it | 520 | // if we're in the middle of an emacs-style keychain, exit it |
524 | next_key = 0; | 521 | next_key = 0; |
525 | if (saved_keymode) { | 522 | if (saved_keymode) { |