X-Git-Url: https://git.xinqibao.xyz/dwm.git/blobdiff_plain/cdd6c3e820a360aaca1e8cd9c4b882bac1448261..3fd39feb4153cf73f26223918bc8145ee98a9a92:/dwm.c diff --git a/dwm.c b/dwm.c index f61ce3b..a4deccf 100644 --- a/dwm.c +++ b/dwm.c @@ -232,10 +232,6 @@ Regs *regs = NULL; /* configuration, allows nested code to access above variables */ #include "config.h" -#define NTAGS (sizeof tags / sizeof tags[0]) -Bool seltags[NTAGS] = {[0] = True}; -Bool prevtags[NTAGS] = {[0] = True}; - /* function implementations */ void applyrules(Client *c) { @@ -670,7 +666,7 @@ void expose(XEvent *e) { XExposeEvent *ev = &e->xexpose; - if(ev->count == 0) { + if(0 == ev->count) { if(barwin == ev->window) drawbar(); } @@ -784,7 +780,7 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size) { int n; XTextProperty name; - if(!text || size == 0) + if(!text || 0 == size) return False; text[0] = '\0'; XGetTextProperty(dpy, w, &name, atom); @@ -1402,7 +1398,7 @@ setmwfact(const char *arg) { if(!(ISTILE)) return; /* arg handling, manipulate mwfact */ - if(arg == NULL) + if(NULL == arg) mwfact = MWFACT; else if(1 == sscanf(arg, "%lf", &delta)) { if(arg[0] == '+' || arg[0] == '-') @@ -1519,8 +1515,8 @@ spawn(const char *arg) { return; /* The double-fork construct avoids zombie processes and keeps the code * clean from stupid signal handlers. */ - if(fork() == 0) { - if(fork() == 0) { + if(0 == fork()) { + if(0 == fork()) { if(dpy) close(ConnectionNumber(dpy)); setsid(); @@ -1580,7 +1576,7 @@ tile(void) { nw = 0; /* gcc stupidity requires this */ for(i = 0, c = mc = nexttiled(clients); c; c = nexttiled(c->next), i++) { c->ismax = False; - if(i == 0) { /* master */ + if(0 == i) { /* master */ nw = mw - 2 * c->border; nh = wah - 2 * c->border; } @@ -1596,7 +1592,8 @@ tile(void) { nh = th - 2 * c->border; } resize(c, nx, ny, nw, nh, True); - if((c->h < bh) || (c->h > nh)) /* client doesn't accept geometry */ + if((c->h < bh) || (c->h > nh) || (c->w < bh) || (c->w > nw)) + /* client doesn't accept size constraints */ resize(c, nx, ny, nw, nh, False); if(n > 1 && th != wah) ny = c->y + c->h + 2 * c->border; @@ -1839,7 +1836,7 @@ view(const char *arg) { memcpy(prevtags, seltags, sizeof seltags); for(i = 0; i < NTAGS; i++) - seltags[i] = arg == NULL; + seltags[i] = (NULL == arg); seltags[idxoftag(arg)] = True; arrange(); }