diff options
author | Thomas Lübking <thomas.luebking@gmail.com> | 2016-07-15 15:16:54 (GMT) |
---|---|---|
committer | Thomas Lübking <thomas.luebking@gmail.com> | 2016-08-27 07:36:19 (GMT) |
commit | 1e235e3f01733e3282a76e6be8862206d1504bdf (patch) | |
tree | e605c784c9f7042299c706acfb69d8cbab447657 | |
parent | 2c6647112667109b109e578ffd55ae8409c9e1af (diff) | |
download | fluxbox-1e235e3f01733e3282a76e6be8862206d1504bdf.zip fluxbox-1e235e3f01733e3282a76e6be8862206d1504bdf.tar.bz2 |
Grab keyboard synchronouosly to allow replays
This allows to catch if a grabbed key (combo) is actually w/o effect
(because eg. the OnDesktop condition does not match) and then replay
the event ungrabbed to pass it to the focused client.
Just like mouse grabbing, this BEARS THE POTENTIAL TO LOCK INPUT, thus
needs AS MUCH TESTING AS POSSIBLE
BUG: 1137
-rw-r--r-- | src/FbTk/KeyUtil.cc | 2 | ||||
-rw-r--r-- | src/Screen.cc | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/FbTk/KeyUtil.cc b/src/FbTk/KeyUtil.cc index 10bc118..46a712a 100644 --- a/src/FbTk/KeyUtil.cc +++ b/src/FbTk/KeyUtil.cc | |||
@@ -129,7 +129,7 @@ void KeyUtil::grabKey(unsigned int key, unsigned int mod, Window win) { | |||
129 | for (int i = 0; i < 8; i++) { | 129 | for (int i = 0; i < 8; i++) { |
130 | XGrabKey(display, key, mod | (i & 1 ? LockMask : 0) | | 130 | XGrabKey(display, key, mod | (i & 1 ? LockMask : 0) | |
131 | (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0), | 131 | (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0), |
132 | win, True, GrabModeAsync, GrabModeAsync); | 132 | win, True, GrabModeAsync, GrabModeSync); |
133 | } | 133 | } |
134 | 134 | ||
135 | } | 135 | } |
diff --git a/src/Screen.cc b/src/Screen.cc index 013b6c6..277952b 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -658,11 +658,14 @@ void BScreen::propertyNotify(Atom atom) { | |||
658 | 658 | ||
659 | void BScreen::keyPressEvent(XKeyEvent &ke) { | 659 | void BScreen::keyPressEvent(XKeyEvent &ke) { |
660 | if (Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode, | 660 | if (Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode, |
661 | Keys::GLOBAL|Keys::ON_DESKTOP)) { | 661 | Keys::GLOBAL|(ke.subwindow ? 0 : Keys::ON_DESKTOP))) { |
662 | 662 | ||
663 | // re-grab keyboard, so we don't pass KeyRelease to clients | 663 | // re-grab keyboard, so we don't pass KeyRelease to clients |
664 | // also for catching invalid keys in the middle of keychains | 664 | // also for catching invalid keys in the middle of keychains |
665 | FbTk::EventManager::instance()->grabKeyboard(rootWindow().window()); | 665 | FbTk::EventManager::instance()->grabKeyboard(rootWindow().window()); |
666 | XAllowEvents(Fluxbox::instance()->display(), SyncKeyboard, CurrentTime); | ||
667 | } else { | ||
668 | XAllowEvents(Fluxbox::instance()->display(), ReplayKeyboard, CurrentTime); | ||
666 | } | 669 | } |
667 | } | 670 | } |
668 | 671 | ||