diff options
author | Anselm R. Garbe <arg@suckless.org> | 2007-03-07 10:57:23 +0100 |
---|---|---|
committer | Anselm R. Garbe <arg@suckless.org> | 2007-03-07 10:57:23 +0100 |
commit | 48a7ab2225d1e53a8e0fd73bca975bb7695d1b06 (patch) | |
tree | 085ad67ddb3fd69ca053b9893c128ed3fa769953 | |
parent | d8ea9368993538b132ac019859b37f4bbbf85962 (diff) |
grab on the root window, it is correct, all lockers do that
-rw-r--r-- | config.mk | 2 | ||||
-rw-r--r-- | slock.c | 5 |
2 files changed, 3 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | # slock version | 1 | # slock version |
2 | VERSION = 0.5 | 2 | VERSION = 0.6 |
3 | 3 | ||
4 | # Customize below to fit your system | 4 | # Customize below to fit your system |
5 | 5 | ||
@@ -81,21 +81,20 @@ main(int argc, char **argv) { | |||
81 | w = XCreateWindow(dpy, root, 0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen), | 81 | w = XCreateWindow(dpy, root, 0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen), |
82 | 0, DefaultDepth(dpy, screen), CopyFromParent, | 82 | 0, DefaultDepth(dpy, screen), CopyFromParent, |
83 | DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixel, &wa); | 83 | DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixel, &wa); |
84 | |||
85 | XAllocNamedColor(dpy, DefaultColormap(dpy, screen), "black", &black, &dummy); | 84 | XAllocNamedColor(dpy, DefaultColormap(dpy, screen), "black", &black, &dummy); |
86 | pmap = XCreateBitmapFromData(dpy, w, curs, 8, 8); | 85 | pmap = XCreateBitmapFromData(dpy, w, curs, 8, 8); |
87 | invisible = XCreatePixmapCursor(dpy, pmap, pmap, &black, &black, 0, 0); | 86 | invisible = XCreatePixmapCursor(dpy, pmap, pmap, &black, &black, 0, 0); |
88 | XDefineCursor(dpy, w, invisible); | 87 | XDefineCursor(dpy, w, invisible); |
89 | XMapRaised(dpy, w); | 88 | XMapRaised(dpy, w); |
90 | for(len = 1000; len; len--) { | 89 | for(len = 1000; len; len--) { |
91 | if(XGrabPointer(dpy, w, False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, | 90 | if(XGrabPointer(dpy, root, False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, |
92 | GrabModeAsync, GrabModeSync, None, invisible, CurrentTime) == GrabSuccess) | 91 | GrabModeAsync, GrabModeSync, None, invisible, CurrentTime) == GrabSuccess) |
93 | break; | 92 | break; |
94 | usleep(1000); | 93 | usleep(1000); |
95 | } | 94 | } |
96 | if((running = running && (len > 0))) { | 95 | if((running = running && (len > 0))) { |
97 | for(len = 1000; len; len--) { | 96 | for(len = 1000; len; len--) { |
98 | if(XGrabKeyboard(dpy, w, True, GrabModeAsync, GrabModeAsync, CurrentTime) | 97 | if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime) |
99 | == GrabSuccess) | 98 | == GrabSuccess) |
100 | break; | 99 | break; |
101 | usleep(1000); | 100 | usleep(1000); |