tmade for/if/else constructs more consistent, some code polishing - dwm - [fork] customized build of dwm, the dynamic window manager
 (HTM) git clone git://src.adamsgaard.dk/dwm
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit e256afe31ef6a70eceb632ddfe717bfe6d8d9169
 (DIR) parent 64cfebc5e7d005dfff93a2468df860522fad085a
 (HTM) Author: Anselm R. Garbe <arg@suckless.org>
       Date:   Wed, 14 Feb 2007 09:09:18 +0100
       
       made for/if/else constructs more consistent, some code polishing
       Diffstat:
         M client.c                            |       6 +++---
         M event.c                             |      12 ++++++------
         M main.c                              |      11 +++++------
         M tag.c                               |       3 +--
         M view.c                              |       7 +++----
       
       5 files changed, 18 insertions(+), 21 deletions(-)
       ---
 (DIR) diff --git a/client.c b/client.c
       t@@ -304,8 +304,8 @@ updatesizehints(Client *c) {
                }
                else
                        c->minax = c->minay = c->maxax = c->maxay = 0;
       -        c->isfixed = (c->maxw && c->minw && c->maxh && c->minh &&
       -                                c->maxw == c->minw && c->maxh == c->minh);
       +        c->isfixed = (c->maxw && c->minw && c->maxh && c->minh
       +                        && c->maxw == c->minw && c->maxh == c->minh);
        }
        
        void
       t@@ -325,7 +325,7 @@ updatetitle(Client *c) {
                        strncpy(c->name, (char *)name.value, sizeof c->name);
                else {
                        if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
       -                                && n > 0 && *list)
       +                && n > 0 && *list)
                        {
                                strncpy(c->name, *list, sizeof c->name);
                                XFreeStringList(list);
 (DIR) diff --git a/event.c b/event.c
       t@@ -156,8 +156,8 @@ buttonpress(XEvent *e) {
                        }
                        else if(ev->button == Button2)
                                zoom(NULL);
       -                else if(ev->button == Button3 && (arrange == dofloat || c->isfloat)
       -                                && !c->isfixed)
       +                else if(ev->button == Button3
       +                && (arrange == dofloat || c->isfloat) && !c->isfixed)
                        {
                                restack();
                                resizemouse(c);
       t@@ -184,7 +184,8 @@ configurerequest(XEvent *e) {
                                        c->w = ev->width;
                                if(ev->value_mask & CWHeight)
                                        c->h = ev->height;
       -                        if((ev->value_mask & (CWX | CWY)) && !(ev->value_mask & (CWWidth | CWHeight)))
       +                        if((ev->value_mask & (CWX | CWY))
       +                        && !(ev->value_mask & (CWWidth | CWHeight)))
                                        configure(c);
                                resize(c, False);
                                if(!isvisible(c))
       t@@ -249,14 +250,13 @@ keypress(XEvent *e) {
                XKeyEvent *ev = &e->xkey;
        
                keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
       -        for(i = 0; i < len; i++) {
       +        for(i = 0; i < len; i++)
                        if(keysym == key[i].keysym
       -                        && CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
       +                && CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
                        {
                                if(key[i].func)
                                        key[i].func(&key[i].arg);
                        }
       -        }
        }
        
        static void
 (DIR) diff --git a/main.c b/main.c
       t@@ -69,9 +69,8 @@ scan(void) {
                wins = NULL;
                if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) {
                        for(i = 0; i < num; i++) {
       -                        if(!XGetWindowAttributes(dpy, wins[i], &wa))
       -                                continue;
       -                        if(wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1))
       +                        if(!XGetWindowAttributes(dpy, wins[i], &wa)
       +                        || wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1))
                                        continue;
                                if(wa.map_state == IsViewable)
                                        manage(wins[i], &wa);
       t@@ -104,12 +103,12 @@ setup(void) {
                /* init modifier map */
                numlockmask = 0;
                modmap = XGetModifierMapping(dpy);
       -        for (i = 0; i < 8; i++) {
       +        for (i = 0; i < 8; i++)
                        for (j = 0; j < modmap->max_keypermod; j++) {
       -                        if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock))
       +                        if(modmap->modifiermap[i * modmap->max_keypermod + j]
       +                                        == XKeysymToKeycode(dpy, XK_Num_Lock))
                                        numlockmask = (1 << i);
                        }
       -        }
                XFreeModifiermap(modmap);
                /* select for events */
                wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
 (DIR) diff --git a/tag.c b/tag.c
       t@@ -78,10 +78,9 @@ settags(Client *c, Client *trans) {
                Bool matched = trans != NULL;
                XClassHint ch = { 0 };
        
       -        if(matched) {
       +        if(matched)
                        for(i = 0; i < ntags; i++)
                                c->tags[i] = trans->tags[i];
       -        }
                else {
                        XGetClassHint(dpy, c->win, &ch);
                        snprintf(prop, sizeof prop, "%s:%s:%s",
 (DIR) diff --git a/view.c b/view.c
       t@@ -55,9 +55,8 @@ dofloat(void) {
                Client *c;
        
                for(c = clients; c; c = c->next) {
       -                if(isvisible(c)) {
       +                if(isvisible(c))
                                resize(c, True);
       -                }
                        else
                                XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
                }
       t@@ -150,7 +149,7 @@ focusprev(Arg *arg) {
        void
        incnmaster(Arg *arg) {
                if((arrange == dofloat) || (nmaster + arg->i < 1)
       -                || (wah / (nmaster + arg->i) <= 2 * BORDERPX))
       +        || (wah / (nmaster + arg->i) <= 2 * BORDERPX))
                        return;
                nmaster += arg->i;
                if(sel)
       t@@ -175,7 +174,7 @@ resizemaster(Arg *arg) {
                        master = MASTER;
                else {
                        if(waw * (master + arg->i) / 1000 >= waw - 2 * BORDERPX
       -                        || waw * (master + arg->i) / 1000 <= 2 * BORDERPX)
       +                || waw * (master + arg->i) / 1000 <= 2 * BORDERPX)
                                return;
                        master += arg->i;
                }