aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Keys.cc23
-rw-r--r--src/Screen.cc2
2 files changed, 18 insertions, 7 deletions
diff --git a/src/Keys.cc b/src/Keys.cc
index 1e66463..072cba9 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -522,6 +522,8 @@ bool Keys::doAction(int type, unsigned int mods, unsigned int key,
522 if (!m_keylist) 522 if (!m_keylist)
523 return false; 523 return false;
524 524
525 static Time first_key_time = 0;
526
525 static Time last_button_time = 0; 527 static Time last_button_time = 0;
526 static unsigned int last_button = 0; 528 static unsigned int last_button = 0;
527 529
@@ -544,6 +546,17 @@ bool Keys::doAction(int type, unsigned int mods, unsigned int key,
544 isdouble = double_click; 546 isdouble = double_click;
545 } 547 }
546 548
549 auto resetKeyChain = [&]() {
550 first_key_time = 0;
551 next_key.reset();
552 if (saved_keymode) {
553 setKeyMode(saved_keymode);
554 saved_keymode.reset();
555 }
556 };
557 if (type == KeyPress && first_key_time && time - first_key_time > 5000)
558 resetKeyChain();
559
547 if (!next_key) 560 if (!next_key)
548 next_key = m_keylist; 561 next_key = m_keylist;
549 562
@@ -560,8 +573,10 @@ bool Keys::doAction(int type, unsigned int mods, unsigned int key,
560 return true; // if there's a motion action, prevent replay to the client (but do nothing) 573 return true; // if there's a motion action, prevent replay to the client (but do nothing)
561 574
562 if (temp_key && !temp_key->keylist.empty()) { // emacs-style 575 if (temp_key && !temp_key->keylist.empty()) { // emacs-style
563 if (!saved_keymode) 576 if (!saved_keymode) {
577 first_key_time = time;
564 saved_keymode = m_keylist; 578 saved_keymode = m_keylist;
579 }
565 next_key = temp_key; 580 next_key = temp_key;
566 setKeyMode(next_key); 581 setKeyMode(next_key);
567 return true; 582 return true;
@@ -570,11 +585,7 @@ bool Keys::doAction(int type, unsigned int mods, unsigned int key,
570 if (type == KeyPress && 585 if (type == KeyPress &&
571 !FbTk::KeyUtil::instance().keycodeToModmask(key)) { 586 !FbTk::KeyUtil::instance().keycodeToModmask(key)) {
572 // if we're in the middle of an emacs-style keychain, exit it 587 // if we're in the middle of an emacs-style keychain, exit it
573 next_key.reset(); 588 resetKeyChain();
574 if (saved_keymode) {
575 setKeyMode(saved_keymode);
576 saved_keymode.reset();
577 }
578 } 589 }
579 return false; 590 return false;
580 } 591 }
diff --git a/src/Screen.cc b/src/Screen.cc
index 53b772e..c24250a 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -656,7 +656,7 @@ void BScreen::propertyNotify(Atom atom) {
656 656
657void BScreen::keyPressEvent(XKeyEvent &ke) { 657void BScreen::keyPressEvent(XKeyEvent &ke) {
658 if (Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode, 658 if (Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode,
659 Keys::GLOBAL|(ke.subwindow ? 0 : Keys::ON_DESKTOP))) { 659 Keys::GLOBAL|(ke.subwindow ? 0 : Keys::ON_DESKTOP), 0, ke.time)) {
660 660
661 // re-grab keyboard, so we don't pass KeyRelease to clients 661 // re-grab keyboard, so we don't pass KeyRelease to clients
662 // also for catching invalid keys in the middle of keychains 662 // also for catching invalid keys in the middle of keychains