diff options
author | John Ankarström <john@ankarstrom.se> | 2021-07-12 14:21:56 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-07-12 14:21:56 +0200 |
commit | 9b935c49a70ae795df3f51b1ea3b4772259028f4 (patch) | |
tree | b662f2cfc9011acf57e75040b27b05050d719249 | |
parent | dd6407b6c0e96c37d6bb3825e9f3f309167df77c (diff) | |
download | dwim-9b935c49a70ae795df3f51b1ea3b4772259028f4.tar.gz |
xchord.c: Change coding style
-rw-r--r-- | xchord.c | 24 |
1 files changed, 11 insertions, 13 deletions
@@ -34,12 +34,11 @@ main(int argc, char *argv[]) unsigned char mask[(XI_LASTEVENT+7)/8]; XEvent ev; XGenericEventCookie *cookie; - XIEvent *xiev; XIEventMask evmasks[1]; XIRawEvent *rev; dpy = XOpenDisplay(NULL); - if (!dpy) { + if(!dpy){ fprintf(stderr, "could not open display"); return 1; } @@ -62,35 +61,34 @@ main(int argc, char *argv[]) p = 0; /* watch for events */ - for (;;) { + for(;;){ XNextEvent(dpy, &ev); XPutBackEvent(dpy, &ev); - if (!XCheckTypedEvent(dpy, GenericEvent, &ev)) + if(!XCheckTypedEvent(dpy, GenericEvent, &ev)) continue; - if (cookie->type != GenericEvent || !XGetEventData(dpy, cookie)) + if(cookie->type != GenericEvent || !XGetEventData(dpy, cookie)) continue; - xiev = (XIEvent*)cookie->data; - rev = (XIRawEvent*)xiev; + rev = (XIRawEvent*)cookie->data; - switch (cookie->evtype) { + switch(cookie->evtype){ case XI_RawButtonPress: /* 1 pressed (first step) */ - if (rev->detail == 1) p = 1; + if(rev->detail == 1) p = 1; /* 1 + 3 pressed (second step) */ - if (p > 0 && rev->detail == 3) p = 2; + if(p > 0 && rev->detail == 3) p = 2; break; case XI_RawButtonRelease: /* 1 pressed + 3 pressed + 3 released (third step) */ - if (p == 2 && rev->detail == 3) { + if(p == 2 && rev->detail == 3){ p = 3; - if (vfork() == 0) { + if(vfork() == 0){ execlp("dwim", "dwim", NULL); err(1, "execlp"); } } /* 1 released (reset) */ - if ((p == 1 || p == 3) && rev->detail == 1) p = 0; + if((p == 1 || p == 3) && rev->detail == 1) p = 0; break; } |