GSOD: Better keyboard grab

XGrabKeyboard() may fail if Alert*() is called from a child process
during an activated passive key grab, e.g. due to a keybinding doing
an "exec some-prog", and execl(some-prog) fails.
If XGrabKeyboard() fails the GSOD will not receive key events and only
the pointer can be used to interact with the GSOD.

Therefore we now also grab all possible keys/modifiers which should
normally include the Fn keys we want, and to some degree ensure that
other keyboard input is caught and ignored.
However, it seems that passive key grabs without modifiers may be
activated (queued) and prevent further key events to the GSOD -
presumably not a major problem in practice.
This commit is contained in:
Kim Woelders 2019-04-25 08:41:29 +02:00
parent e05a7293c6
commit 84616e4617
1 changed files with 2 additions and 0 deletions

View File

@ -314,6 +314,8 @@ ShowAlert(const char *title,
XGrabPointer(dd, win, False, ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
XGrabKeyboard(dd, win, False, GrabModeAsync, GrabModeAsync, CurrentTime);
XGrabKey(dd, AnyKey, AnyModifier, win, False, GrabModeAsync, GrabModeAsync);
XSetInputFocus(dd, win, RevertToPointerRoot, CurrentTime);
XSync(dd, False);