[hackers] [slock] grab on the slock window instead on the root window

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Fri Mar 02 21:52:40 2007

changeset: 21:bd24ea7fcca2
tag: tip
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Fri Mar 02 21:50:05 2007 +0100
summary: grab on the slock window instead on the root window

diff -r 1d238da723cb -r bd24ea7fcca2 slock.c
--- a/slock.c Wed Feb 21 22:16:23 2007 +0100
+++ b/slock.c Fri Mar 02 21:50:05 2007 +0100
@@ -86,15 +86,16 @@ main(int argc, char **argv) {
         pmap = XCreateBitmapFromData(dpy, w, curs, 8, 8);
         invisible = XCreatePixmapCursor(dpy, pmap, pmap, &black, &black, 0, 0);
         XDefineCursor(dpy, w, invisible);
+ XMapRaised(dpy, w);
         for(len = 1000; len; len--) {
- if(XGrabPointer(dpy, root, False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
+ if(XGrabPointer(dpy, w, False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
                         GrabModeAsync, GrabModeSync, None, invisible, CurrentTime) == GrabSuccess)
                         break;
                 usleep(1000);
         }
         if((running = running && (len > 0))) {
                 for(len = 1000; len; len--) {
- if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime)
+ if(XGrabKeyboard(dpy, w, True, GrabModeAsync, GrabModeAsync, CurrentTime)
                                 == GrabSuccess)
                                 break;
                         usleep(1000);
@@ -102,7 +103,6 @@ main(int argc, char **argv) {
                 running = (len > 0);
         }
         len = 0;
- XMapRaised(dpy, w);
         XSync(dpy, False);
 
         /* main event loop */
Received on Fri Mar 02 2007 - 21:52:40 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:56:06 UTC