diff options
author | John Ankarström <john@ankarstrom.se> | 2021-07-12 14:19:09 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-07-12 14:19:09 +0200 |
commit | dd6407b6c0e96c37d6bb3825e9f3f309167df77c (patch) | |
tree | 3b84f31c0bfca22559c60245e0080b3b19948cf2 /xchord.c | |
parent | 25281507efa4407a70f86e5b35986ccd9f11b6fe (diff) | |
download | dwim-dd6407b6c0e96c37d6bb3825e9f3f309167df77c.tar.gz |
xchord: Fix bug
Diffstat (limited to 'xchord.c')
-rw-r--r-- | xchord.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -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; } |