aboutsummaryrefslogtreecommitdiff
path: root/xchord.c
diff options
context:
space:
mode:
Diffstat (limited to 'xchord.c')
-rw-r--r--xchord.c14
1 files changed, 5 insertions, 9 deletions
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;
}