Introduction
Introduction Statistics Contact Development Disclaimer Help
made slock more readable, added root variable because we intend to call RootWin…
git clone git://git.suckless.org/slock
Log
Files
Refs
README
LICENSE
---
commit d83a9a1d01fb70df9859ea231c8d7a2fb898c1e7
parent ae8cce24d3eb590c3cc810eb8487296ee1db0718
Author: Anselm R. Garbe <[email protected]>
Date: Wed, 21 Feb 2007 22:16:23 +0100
made slock more readable, added root variable because we intend to call RootWin…
Diffstat:
M slock.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/slock.c b/slock.c
@@ -58,7 +58,7 @@ main(int argc, char **argv) {
Display *dpy;
KeySym ksym;
Pixmap pmap;
- Window w;
+ Window root, w;
XColor black, dummy;
XEvent ev;
XSetWindowAttributes wa;
@@ -73,12 +73,12 @@ main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
screen = DefaultScreen(dpy);
+ root = RootWindow(dpy, screen);
/* init */
wa.override_redirect = 1;
wa.background_pixel = BlackPixel(dpy, screen);
- w = XCreateWindow(dpy, RootWindow(dpy, screen), 0, 0,
- DisplayWidth(dpy, screen), DisplayHeight(dpy, screen),
+ w = XCreateWindow(dpy, root, 0, 0, DisplayWidth(dpy, screen), DisplayH…
0, DefaultDepth(dpy, screen), CopyFromParent,
DefaultVisual(dpy, screen), CWOverrideRedirect | CWBac…
@@ -86,15 +86,21 @@ 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);
- for(len = 1000; len && (XGrabPointer(dpy, RootWindow(dpy, screen), Fal…
- ButtonPressMask | ButtonReleaseMask | PointerMotionMas…
- GrabModeAsync, GrabModeSync, None, invisible, CurrentT…
+ for(len = 1000; len; len--) {
+ if(XGrabPointer(dpy, root, False, ButtonPressMask | ButtonRele…
+ GrabModeAsync, GrabModeSync, None, invisible, CurrentT…
+ break;
usleep(1000);
- running = running && (len > 0);
- for(len = 1000; len && (XGrabKeyboard(dpy, RootWindow(dpy, screen), Tr…
- GrabModeAsync, CurrentTime) != GrabSuccess); len--)
- usleep(1000);
- running = running && (len > 0);
+ }
+ if((running = running && (len > 0))) {
+ for(len = 1000; len; len--) {
+ if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabM…
+ == GrabSuccess)
+ break;
+ usleep(1000);
+ }
+ running = (len > 0);
+ }
len = 0;
XMapRaised(dpy, w);
XSync(dpy, False);
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.