summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick <devnull@mailinator.com>2015-10-14 18:20:40 +0800
committerPatrick <devnull@mailinator.com>2015-10-14 18:20:40 +0800
commit11618361e41879910fc753a9a31fe9a62dc4a620 (patch)
treeb2a143c91e403dd653c06a311a1367f2daac570d
parente1120cf4e2b0ad11c8244d4b5de03bf95682ad19 (diff)
abuse c99 by localizing variable declaration and use
-rw-r--r--x-alt-tab.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/x-alt-tab.c b/x-alt-tab.c
index a979177..6d6b810 100644
--- a/x-alt-tab.c
+++ b/x-alt-tab.c
@@ -15,11 +15,11 @@ 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) {
- XWindowAttributes attr;
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) {
@@ -45,7 +45,6 @@ int main(int argc, char **argv) {
Display *dpy;
unsigned int nwins = 0;
Window root, parent, *wins = 0;
- Rotation r;
if ( (dpy = XOpenDisplay(NULL)) == NULL)
return 1;
@@ -55,7 +54,7 @@ int main(int argc, char **argv) {
if (nwins <= 1)
return 0;
- r = (argc == 1) ? bottom_to_top : top_to_bottom;
+ Rotation r = (argc == 1) ? bottom_to_top : top_to_bottom;
x_alt_tab(r, dpy, wins, nwins);
return 0;
}