diff options
author | Anselm R. Garbe <arg@10kloc.org> | 2006-10-16 12:59:37 +0200 |
---|---|---|
committer | Anselm R. Garbe <arg@10kloc.org> | 2006-10-16 12:59:37 +0200 |
commit | 10ccc43597910428a22129cd942881835d95b5c0 (patch) | |
tree | 6426596582bf100c53b5c7f935ef10db60084f42 | |
parent | 9fa696d6c13e64b5bdc9dd01e4965eccec4b23cf (diff) |
added pointer grab
-rw-r--r-- | config.mk | 2 | ||||
-rw-r--r-- | slock.c | 9 |
2 files changed, 7 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | # slock version | 1 | # slock version |
2 | VERSION = 0.1 | 2 | VERSION = 0.2 |
3 | 3 | ||
4 | # Customize below to fit your system | 4 | # Customize below to fit your system |
5 | 5 | ||
@@ -63,9 +63,6 @@ main(int argc, char **argv) { | |||
63 | 63 | ||
64 | /* init */ | 64 | /* init */ |
65 | passwd[0] = 0; | 65 | passwd[0] = 0; |
66 | while(XGrabKeyboard(dpy, RootWindow(dpy, screen), True, GrabModeAsync, | ||
67 | GrabModeAsync, CurrentTime) != GrabSuccess) | ||
68 | usleep(1000); | ||
69 | 66 | ||
70 | wa.override_redirect = 1; | 67 | wa.override_redirect = 1; |
71 | wa.background_pixel = BlackPixel(dpy, screen); | 68 | wa.background_pixel = BlackPixel(dpy, screen); |
@@ -78,6 +75,11 @@ main(int argc, char **argv) { | |||
78 | pmap = XCreateBitmapFromData(dpy, w, curs, 8, 8); | 75 | pmap = XCreateBitmapFromData(dpy, w, curs, 8, 8); |
79 | invisible = XCreatePixmapCursor(dpy, pmap, pmap, &black, &black, 0, 0); | 76 | invisible = XCreatePixmapCursor(dpy, pmap, pmap, &black, &black, 0, 0); |
80 | XDefineCursor(dpy, w, invisible); | 77 | XDefineCursor(dpy, w, invisible); |
78 | running = XGrabPointer(dpy, RootWindow(dpy, screen), False, | ||
79 | ButtonPressMask | ButtonReleaseMask | PointerMotionMask, | ||
80 | GrabModeAsync, GrabModeSync, None, invisible, CurrentTime) == GrabSuccess | ||
81 | && XGrabKeyboard(dpy, RootWindow(dpy, screen), True, GrabModeAsync, | ||
82 | GrabModeAsync, CurrentTime) == GrabSuccess; | ||
81 | XMapRaised(dpy, w); | 83 | XMapRaised(dpy, w); |
82 | XSync(dpy, False); | 84 | XSync(dpy, False); |
83 | 85 | ||
@@ -119,6 +121,7 @@ main(int argc, char **argv) { | |||
119 | break; | 121 | break; |
120 | } | 122 | } |
121 | } | 123 | } |
124 | XUngrabPointer(dpy, CurrentTime); | ||
122 | XFreePixmap(dpy, pmap); | 125 | XFreePixmap(dpy, pmap); |
123 | XDestroyWindow(dpy, w); | 126 | XDestroyWindow(dpy, w); |
124 | XCloseDisplay(dpy); | 127 | XCloseDisplay(dpy); |