added pointer grab
This commit is contained in:
parent
9fa696d6c1
commit
10ccc43597
2 changed files with 7 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
# slock version
|
# slock version
|
||||||
VERSION = 0.1
|
VERSION = 0.2
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
|
9
slock.c
9
slock.c
|
@ -63,9 +63,6 @@ main(int argc, char **argv) {
|
||||||
|
|
||||||
/* init */
|
/* init */
|
||||||
passwd[0] = 0;
|
passwd[0] = 0;
|
||||||
while(XGrabKeyboard(dpy, RootWindow(dpy, screen), True, GrabModeAsync,
|
|
||||||
GrabModeAsync, CurrentTime) != GrabSuccess)
|
|
||||||
usleep(1000);
|
|
||||||
|
|
||||||
wa.override_redirect = 1;
|
wa.override_redirect = 1;
|
||||||
wa.background_pixel = BlackPixel(dpy, screen);
|
wa.background_pixel = BlackPixel(dpy, screen);
|
||||||
|
@ -78,6 +75,11 @@ main(int argc, char **argv) {
|
||||||
pmap = XCreateBitmapFromData(dpy, w, curs, 8, 8);
|
pmap = XCreateBitmapFromData(dpy, w, curs, 8, 8);
|
||||||
invisible = XCreatePixmapCursor(dpy, pmap, pmap, &black, &black, 0, 0);
|
invisible = XCreatePixmapCursor(dpy, pmap, pmap, &black, &black, 0, 0);
|
||||||
XDefineCursor(dpy, w, invisible);
|
XDefineCursor(dpy, w, invisible);
|
||||||
|
running = XGrabPointer(dpy, RootWindow(dpy, screen), False,
|
||||||
|
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
|
||||||
|
GrabModeAsync, GrabModeSync, None, invisible, CurrentTime) == GrabSuccess
|
||||||
|
&& XGrabKeyboard(dpy, RootWindow(dpy, screen), True, GrabModeAsync,
|
||||||
|
GrabModeAsync, CurrentTime) == GrabSuccess;
|
||||||
XMapRaised(dpy, w);
|
XMapRaised(dpy, w);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
||||||
|
@ -119,6 +121,7 @@ main(int argc, char **argv) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
XUngrabPointer(dpy, CurrentTime);
|
||||||
XFreePixmap(dpy, pmap);
|
XFreePixmap(dpy, pmap);
|
||||||
XDestroyWindow(dpy, w);
|
XDestroyWindow(dpy, w);
|
||||||
XCloseDisplay(dpy);
|
XCloseDisplay(dpy);
|
||||||
|
|
Loading…
Reference in a new issue