chiark / gitweb /
Change grabs to always grab pointer GrabModeSync master
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 11 Jul 2016 14:15:55 +0000 (15:15 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 11 Jul 2016 14:17:59 +0000 (15:17 +0100)
Experimentally, changing keyboard mode to GrabModeSync means xtrlock
cannot see us typing any more.

But we don't care about mouse events.

Hopefully this will fix #830726.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
xtrlock.c

index 20208dd..dee9be7 100644 (file)
--- a/xtrlock.c
+++ b/xtrlock.c
@@ -191,7 +191,7 @@ int main(int argc, char **argv){
   gs=0; /*gs==grab successful*/
   for (tvt=0 ; tvt<100; tvt++) {
     ret = XGrabKeyboard(display,window,False,
-                       GrabModeAsync, /* pointer_mode */
+                       GrabModeSync, /* pointer_mode */
                        GrabModeAsync, /* keyboard_mode */
                        CurrentTime);
     if (ret == GrabSuccess) {
@@ -210,10 +210,10 @@ int main(int argc, char **argv){
   }
 
   if (XGrabPointer(display,window,False,(KeyPressMask|KeyReleaseMask)&0,
-                  GrabModeAsync, /* pointer_mode */
-                  GrabModeAsync, /* pointer_mode */
+                  GrabModeSync, /* pointer_mode */
+                  GrabModeAsync, /* keyboard_mode */
                   None,
-               cursor,CurrentTime)!=GrabSuccess) {
+                  cursor,CurrentTime)!=GrabSuccess) {
     XUngrabKeyboard(display,CurrentTime);
     fprintf(stderr,"xtrlock (version %s): cannot grab pointer\n",
            program_version);