diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | xchord.c | 14 |
2 files changed, 6 insertions, 9 deletions
@@ -1,6 +1,7 @@ BINDIR ?= /usr/local/bin CFLAGS = -I/usr/X11R7/include LDFLAGS = -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -lXi +CFLAGS += -Wall -pedantic xchord: xchord.c @@ -24,13 +24,6 @@ #include <X11/extensions/XInput2.h> #include <X11/Xlib.h> -#define die(s, ...) do { \ - fprintf(stderr, "%s: ", argv[0]); \ - fprintf(stderr, __VA_ARGS__); \ - fprintf(stderr, "\n"); \ - exit(s); \ -} while (0) - Display *dpy; Window rwin; @@ -46,7 +39,10 @@ main(int argc, char *argv[]) XIRawEvent *rev; dpy = XOpenDisplay(NULL); - if (!dpy) die(1, "could not open display"); + if (!dpy) { + fprintf(stderr, "could not open display"); + return 1; + } rwin = DefaultRootWindow(dpy); /* select events */ @@ -94,7 +90,7 @@ main(int argc, char *argv[]) } } /* 1 released (reset) */ - if (p == 3 && rev->detail == 1) p = 0; + if ((p == 1 || p == 3) && rev->detail == 1) p = 0; break; } |