From 980ab5e3f5a843e1d89a178a5d8e8c260eac5efc Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Wed, 21 Jan 2015 10:06:01 +0100 Subject: Fix behavior for autorepeat keys This reverts 58e09b719077605efadac9b712acb8f5e752f732 after having regressions and bug reports in regards to autorepeated key events are not working anymore. So, the problem with the lost keypress after the workspace change is still open but at least the behavior for other folks is as it was. Since 58e09b7190 seems to be corelated to "auto repeat" keys it might indicate the problem which 58e09b7190 "fixed". We will see. Fixes #1115. --- src/Keys.cc | 6 ++++++ src/Screen.cc | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Keys.cc b/src/Keys.cc index 172d913..31f1722 100644 --- a/src/Keys.cc +++ b/src/Keys.cc @@ -575,6 +575,12 @@ bool Keys::doAction(int type, unsigned int mods, unsigned int key, return false; } + // if focus changes, windows will get NotifyWhileGrabbed, + // which they tend to ignore + if (type == KeyPress) { + XUngrabKeyboard(Fluxbox::instance()->display(), CurrentTime); + } + WinClient *old = WindowCmd::client(); WindowCmd::setClient(current); temp_key->m_command->execute(); diff --git a/src/Screen.cc b/src/Screen.cc index 9c0182b..1d81191 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -680,8 +680,13 @@ void BScreen::propertyNotify(Atom atom) { } void BScreen::keyPressEvent(XKeyEvent &ke) { - Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode, - Keys::GLOBAL|Keys::ON_DESKTOP); + if (Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode, + Keys::GLOBAL|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()); + } } void BScreen::keyReleaseEvent(XKeyEvent &ke) { -- cgit v0.11.2