diff options
| author | Patrick <devnull@mailinator.com> | 2015-10-15 15:38:05 +0800 |
|---|---|---|
| committer | Patrick <devnull@mailinator.com> | 2015-10-15 15:38:05 +0800 |
| commit | 00195baff8d1c3bea711a37852d26fc04edf0b2d (patch) | |
| tree | b4428090feb5e90ed7bba233dcb90ef8ac6941c3 /x-alt-tab.c | |
| parent | 72197fa6a8a48682d54bd81d41ab5a00d56fd167 (diff) | |
switch to defined style standard
Diffstat (limited to 'x-alt-tab.c')
| -rw-r--r-- | x-alt-tab.c | 70 |
1 files changed, 35 insertions, 35 deletions
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; } |
