aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--xchord.c14
2 files changed, 6 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 415b07f..6c701af 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/xchord.c b/xchord.c
index b8acc0f..943b293 100644
--- a/xchord.c
+++ b/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;
}