applied anonymous code cleanup patch

This commit is contained in:
garbeam@gmail.com 2011-07-27 19:59:10 +02:00
parent 69e7d7dfd3
commit a372248b80
1 changed files with 9 additions and 13 deletions

22
dwm.c
View File

@ -433,9 +433,9 @@ buttonpress(XEvent *e) {
} }
if(ev->window == selmon->barwin) { if(ev->window == selmon->barwin) {
i = x = 0; i = x = 0;
do { do
x += TEXTW(tags[i]); x += TEXTW(tags[i]);
} while(ev->x >= x && ++i < LENGTH(tags)); while(ev->x >= x && ++i < LENGTH(tags));
if(i < LENGTH(tags)) { if(i < LENGTH(tags)) {
click = ClkTagBar; click = ClkTagBar;
arg.ui = 1 << i; arg.ui = 1 << i;
@ -720,12 +720,10 @@ dirtomon(int dir) {
if(!(m = selmon->next)) if(!(m = selmon->next))
m = mons; m = mons;
} }
else { else if(selmon == mons)
if(selmon == mons) for(m = mons; m->next; m = m->next);
for(m = mons; m->next; m = m->next); else
else for(m = mons; m->next != selmon; m = m->next);
for(m = mons; m->next != selmon; m = m->next);
}
return m; return m;
} }
@ -1017,12 +1015,11 @@ grabkeys(void) {
KeyCode code; KeyCode code;
XUngrabKey(dpy, AnyKey, AnyModifier, root); XUngrabKey(dpy, AnyKey, AnyModifier, root);
for(i = 0; i < LENGTH(keys); i++) { for(i = 0; i < LENGTH(keys); i++)
if((code = XKeysymToKeycode(dpy, keys[i].keysym))) if((code = XKeysymToKeycode(dpy, keys[i].keysym)))
for(j = 0; j < LENGTH(modifiers); j++) for(j = 0; j < LENGTH(modifiers); j++)
XGrabKey(dpy, code, keys[i].mod | modifiers[j], root, XGrabKey(dpy, code, keys[i].mod | modifiers[j], root,
True, GrabModeAsync, GrabModeAsync); True, GrabModeAsync, GrabModeAsync);
}
} }
} }
@ -1031,7 +1028,6 @@ initfont(const char *fontstr) {
char *def, **missing; char *def, **missing;
int n; int n;
missing = NULL;
dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def); dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
if(missing) { if(missing) {
while(n--) while(n--)
@ -1311,6 +1307,7 @@ ptrtomon(int x, int y) {
return m; return m;
return selmon; return selmon;
} }
void void
quit(const Arg *arg) { quit(const Arg *arg) {
running = False; running = False;
@ -1415,10 +1412,9 @@ run(void) {
XEvent ev; XEvent ev;
/* main event loop */ /* main event loop */
XSync(dpy, False); XSync(dpy, False);
while(running && !XNextEvent(dpy, &ev)) { while(running && !XNextEvent(dpy, &ev))
if(handler[ev.type]) if(handler[ev.type])
handler[ev.type](&ev); /* call handler */ handler[ev.type](&ev); /* call handler */
}
} }
void void