aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.mk2
-rw-r--r--slock.c11
2 files changed, 7 insertions, 6 deletions
diff --git a/config.mk b/config.mk
index 22a1585..83ab773 100644
--- a/config.mk
+++ b/config.mk
@@ -1,5 +1,5 @@
# slock version
-VERSION = 0.4
+VERSION = 0.5
# Customize below to fit your system
diff --git a/slock.c b/slock.c
index 089b950..65722ea 100644
--- a/slock.c
+++ b/slock.c
@@ -86,13 +86,14 @@ 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);
- running = XGrabPointer(dpy, RootWindow(dpy, screen), False,
+ for(len = 1000; len && (XGrabPointer(dpy, RootWindow(dpy, screen), False,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
- GrabModeAsync, GrabModeSync, None, invisible, CurrentTime) == GrabSuccess;
- len = 10;
- for(len = 10; len && (XGrabKeyboard(dpy, RootWindow(dpy, screen), True, GrabModeAsync,
+ GrabModeAsync, GrabModeSync, None, invisible, CurrentTime) != GrabSuccess); len--)
+ usleep(1000);
+ running = running && (len > 0);
+ for(len = 1000; len && (XGrabKeyboard(dpy, RootWindow(dpy, screen), True, GrabModeAsync,
GrabModeAsync, CurrentTime) != GrabSuccess); len--)
- usleep(10000);
+ usleep(1000);
running = running && (len > 0);
len = 0;
XMapRaised(dpy, w);