aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slock.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/slock.c b/slock.c
index db3aae0..836de45 100644
--- a/slock.c
+++ b/slock.c
@@ -8,21 +8,24 @@
8#include <string.h> 8#include <string.h>
9#include <unistd.h> 9#include <unistd.h>
10#include <sys/types.h> 10#include <sys/types.h>
11#include <X11/cursorfont.h>
12#include <X11/keysym.h> 11#include <X11/keysym.h>
13#include <X11/Xlib.h> 12#include <X11/Xlib.h>
14#include <X11/Xutil.h> 13#include <X11/Xutil.h>
15 14
16int 15int
17main(int argc, char **argv) { 16main(int argc, char **argv) {
17 char curs[] = {0, 0, 0, 0, 0, 0, 0, 0};
18 char buf[32], passwd[256]; 18 char buf[32], passwd[256];
19 int num, prev_nitem, screen; 19 int num, prev_nitem, screen;
20 struct spwd *sp; 20 struct spwd *sp;
21 unsigned int i, len; 21 unsigned int i, len;
22 Bool running = True; 22 Bool running = True;
23 KeySym ksym; 23 Cursor invisible;
24 Display *dpy; 24 Display *dpy;
25 KeySym ksym;
26 Pixmap pmap;
25 Window w; 27 Window w;
28 XColor black, dummy;
26 XEvent ev; 29 XEvent ev;
27 XSetWindowAttributes wa; 30 XSetWindowAttributes wa;
28 31
@@ -54,7 +57,10 @@ main(int argc, char **argv) {
54 0, DefaultDepth(dpy, screen), CopyFromParent, 57 0, DefaultDepth(dpy, screen), CopyFromParent,
55 DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixel, &wa); 58 DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixel, &wa);
56 59
57 XDefineCursor(dpy, w, XCreateFontCursor(dpy, XC_coffee_mug)); 60 XAllocNamedColor(dpy, DefaultColormap(dpy, screen), "black", &black, &dummy);
61 pmap = XCreateBitmapFromData(dpy, w, curs, 8, 8);
62 invisible = XCreatePixmapCursor(dpy, pmap, pmap, &black, &black, 0, 0);
63 XDefineCursor(dpy, w, invisible);
58 XMapRaised(dpy, w); 64 XMapRaised(dpy, w);
59 XSync(dpy, False); 65 XSync(dpy, False);
60 66
@@ -103,6 +109,7 @@ main(int argc, char **argv) {
103 break; 109 break;
104 } 110 }
105 } 111 }
112 XFreePixmap(dpy, pmap);
106 XDestroyWindow(dpy, w); 113 XDestroyWindow(dpy, w);
107 XCloseDisplay(dpy); 114 XCloseDisplay(dpy);
108 return 0; 115 return 0;