From 00195baff8d1c3bea711a37852d26fc04edf0b2d Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 15 Oct 2015 15:38:05 +0800 Subject: switch to defined style standard --- x-alt-tab.c | 70 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'x-alt-tab.c') diff --git a/x-alt-tab.c b/x-alt-tab.c index 66ce6ea..c5acc16 100644 --- a/x-alt-tab.c +++ b/x-alt-tab.c @@ -15,45 +15,45 @@ If not, see http://creativecommons.org/publicdomain/zero/1.0/ */ typedef enum RotationEnum { bottom_to_top, top_to_bottom } Rotation; void x_alt_tab(Rotation r, Display *dpy, Window *wins, unsigned int nwins) { - Window *viewables[nwins], *w = 0; - unsigned int vc = 0; - - // make list of viewable windows - XWindowAttributes attr; - for (w = wins; w - wins < nwins; w++) { - XGetWindowAttributes(dpy, *w, &attr); - if (attr.map_state == IsViewable) - viewables[vc++] = w; - } - viewables[vc] = NULL; - - // promote the bottom to top, or demote top to bottom and raise 2nd - if (r == bottom_to_top) - w = viewables[0]; - else { - XLowerWindow(dpy, *(viewables[vc - 1])); - w = viewables[vc - 2]; - } - - XRaiseWindow(dpy, *w); - XSetInputFocus(dpy, *w, RevertToPointerRoot, CurrentTime); - XSync(dpy, True); + Window *viewables[nwins], *w = 0; + unsigned int vc = 0; + + // make list of viewable windows + XWindowAttributes attr; + for (w = wins; w - wins < nwins; w++) { + XGetWindowAttributes(dpy, *w, &attr); + if (attr.map_state == IsViewable) + viewables[vc++] = w; + } + viewables[vc] = NULL; + + // promote the bottom to top, or demote top to bottom and raise 2nd + if (r == bottom_to_top) + w = viewables[0]; + else { + XLowerWindow(dpy, *(viewables[vc - 1])); + w = viewables[vc - 2]; + } + + XRaiseWindow(dpy, *w); + XSetInputFocus(dpy, *w, RevertToPointerRoot, CurrentTime); + XSync(dpy, True); } int main(int argc, char **argv) { - Display *dpy; - unsigned int nwins = 0; - Window root, parent, *wins = 0; + Display *dpy; + unsigned int nwins = 0; + Window root, parent, *wins = 0; - if ( (dpy = XOpenDisplay(NULL)) == NULL) - return 1; + if ( (dpy = XOpenDisplay(NULL)) == NULL) + return 1; - XSync(dpy, True); - XQueryTree(dpy, DefaultRootWindow(dpy), &root, &parent, &wins, &nwins); - if (nwins <= 1) - return 0; + XSync(dpy, True); + XQueryTree(dpy, DefaultRootWindow(dpy), &root, &parent, &wins, &nwins); + if (nwins <= 1) + return 0; - Rotation r = (argc == 1) ? bottom_to_top : top_to_bottom; - x_alt_tab(r, dpy, wins, nwins); - return 0; + Rotation r = (argc == 1) ? bottom_to_top : top_to_bottom; + x_alt_tab(r, dpy, wins, nwins); + return 0; } -- cgit v1.2.3