made for/if/else constructs more consistent, some code polishing
Anselm R. Garbe arg@suckless.org
Wed, 14 Feb 2007 09:09:18 +0100
M
client.c
→
client.c
@@ -304,8 +304,8 @@ c->maxay = size.max_aspect.y;
} 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@@ -325,7 +325,7 @@ if(name.encoding == XA_STRING)
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);
M
event.c
→
event.c
@@ -156,8 +156,8 @@ movemouse(c);
} 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);@@ -184,7 +184,8 @@ if(ev->value_mask & CWWidth)
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))@@ -249,14 +250,13 @@ KeySym keysym;
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
M
main.c
→
main.c
@@ -69,9 +69,8 @@
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);@@ -104,12 +103,12 @@ cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
/* 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
M
view.c
→
view.c
@@ -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); }@@ -150,7 +149,7 @@
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)@@ -175,7 +174,7 @@ if(arg->i == 0)
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; }