Skip to content

Commit

Permalink
grab on the root window, it is correct, all lockers do that
Browse files Browse the repository at this point in the history
  • Loading branch information
Anselm R. Garbe committed Mar 7, 2007
1 parent d8ea936 commit 48a7ab2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# slock version
VERSION = 0.5
VERSION = 0.6

# Customize below to fit your system

Expand Down
5 changes: 2 additions & 3 deletions slock.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,20 @@ main(int argc, char **argv) {
w = XCreateWindow(dpy, root, 0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen),
0, DefaultDepth(dpy, screen), CopyFromParent,
DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixel, &wa);

XAllocNamedColor(dpy, DefaultColormap(dpy, screen), "black", &black, &dummy);
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, w, False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
if(XGrabPointer(dpy, root, 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, w, True, GrabModeAsync, GrabModeAsync, CurrentTime)
if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime)
== GrabSuccess)
break;
usleep(1000);
Expand Down

0 comments on commit 48a7ab2

Please sign in to comment.