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
Thomas Lübking thomas.luebking@gmail.com
2 files changed,
5 insertions(+),
2 deletions(-)
M
src/FbTk/KeyUtil.cc
→
src/FbTk/KeyUtil.cc
@@ -129,7 +129,7 @@ // Grab with numlock, capslock and scrlock
for (int i = 0; i < 8; i++) { XGrabKey(display, key, mod | (i & 1 ? LockMask : 0) | (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0), - win, True, GrabModeAsync, GrabModeAsync); + win, True, GrabModeAsync, GrabModeSync); } }
M
src/Screen.cc
→
src/Screen.cc
@@ -658,11 +658,14 @@ }
void BScreen::keyPressEvent(XKeyEvent &ke) { if (Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode, - Keys::GLOBAL|Keys::ON_DESKTOP)) { + Keys::GLOBAL|(ke.subwindow ? 0 : Keys::ON_DESKTOP))) { // re-grab keyboard, so we don't pass KeyRelease to clients // also for catching invalid keys in the middle of keychains FbTk::EventManager::instance()->grabKeyboard(rootWindow().window()); + XAllowEvents(Fluxbox::instance()->display(), SyncKeyboard, CurrentTime); + } else { + XAllowEvents(Fluxbox::instance()->display(), ReplayKeyboard, CurrentTime); } }