summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@gmail.com>2007-11-04 17:49:56 +0100
committerAnselm R. Garbe <garbeam@gmail.com>2007-11-04 17:49:56 +0100
commit35efafe8ac901b7764b7950d3a7c8565e53c5381 (patch)
treedf1e0b22249dfcd479926942134bd4e1712f2bcd /dwm.c
parentremoved a misleading comment about client title windows, which don't exist an... (diff)
downloaddwm-35efafe8ac901b7764b7950d3a7c8565e53c5381.tar.gz
dwm-35efafe8ac901b7764b7950d3a7c8565e53c5381.zip
we check variable == value, and not the other way - the other way is for beginner programmers.
Diffstat (limited to '')
-rw-r--r--dwm.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/dwm.c b/dwm.c
index e5929f6..f5f7c99 100644
--- a/dwm.c
+++ b/dwm.c
@@ -303,7 +303,7 @@ buttonpress(XEvent *e) {
303 Client *c; 303 Client *c;
304 XButtonPressedEvent *ev = &e->xbutton; 304 XButtonPressedEvent *ev = &e->xbutton;
305 305
306 if(barwin == ev->window) { 306 if(ev->window == barwin) {
307 x = 0; 307 x = 0;
308 for(i = 0; i < LENGTH(tags); i++) { 308 for(i = 0; i < LENGTH(tags); i++) {
309 x += textw(tags[i]); 309 x += textw(tags[i]);
@@ -331,7 +331,7 @@ buttonpress(XEvent *e) {
331 if(CLEANMASK(ev->state) != MODKEY) 331 if(CLEANMASK(ev->state) != MODKEY)
332 return; 332 return;
333 if(ev->button == Button1) { 333 if(ev->button == Button1) {
334 if((floating == layout->arrange) || c->isfloating) 334 if((layout->arrange == floating) || c->isfloating)
335 restack(); 335 restack();
336 else 336 else
337 togglefloating(NULL); 337 togglefloating(NULL);
@@ -662,8 +662,8 @@ void
662expose(XEvent *e) { 662expose(XEvent *e) {
663 XExposeEvent *ev = &e->xexpose; 663 XExposeEvent *ev = &e->xexpose;
664 664
665 if(0 == ev->count) { 665 if(ev->count == 0) {
666 if(barwin == ev->window) 666 if(ev->window == barwin)
667 drawbar(); 667 drawbar();
668 } 668 }
669} 669}
@@ -777,7 +777,7 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size) {
777 int n; 777 int n;
778 XTextProperty name; 778 XTextProperty name;
779 779
780 if(!text || 0 == size) 780 if(!text || size == 0)
781 return False; 781 return False;
782 text[0] = '\0'; 782 text[0] = '\0';
783 XGetTextProperty(dpy, w, &name, atom); 783 XGetTextProperty(dpy, w, &name, atom);
@@ -787,8 +787,7 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size) {
787 strncpy(text, (char *)name.value, size - 1); 787 strncpy(text, (char *)name.value, size - 1);
788 else { 788 else {
789 if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success 789 if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
790 && n > 0 && *list) 790 && n > 0 && *list) {
791 {
792 strncpy(text, *list, size - 1); 791 strncpy(text, *list, size - 1);
793 XFreeStringList(list); 792 XFreeStringList(list);
794 } 793 }
@@ -1123,7 +1122,7 @@ propertynotify(XEvent *e) {
1123 default: break; 1122 default: break;
1124 case XA_WM_TRANSIENT_FOR: 1123 case XA_WM_TRANSIENT_FOR:
1125 XGetTransientForHint(dpy, c->win, &trans); 1124 XGetTransientForHint(dpy, c->win, &trans);
1126 if(!c->isfloating && (c->isfloating = (NULL != getclient(trans)))) 1125 if(!c->isfloating && (c->isfloating = (getclient(trans) != NULL)))
1127 arrange(); 1126 arrange();
1128 break; 1127 break;
1129 case XA_WM_NORMAL_HINTS: 1128 case XA_WM_NORMAL_HINTS:
@@ -1257,9 +1256,9 @@ restack(void) {
1257 drawbar(); 1256 drawbar();
1258 if(!sel) 1257 if(!sel)
1259 return; 1258 return;
1260 if(sel->isfloating || (floating == layout->arrange)) 1259 if(sel->isfloating || (layout->arrange == floating))
1261 XRaiseWindow(dpy, sel->win); 1260 XRaiseWindow(dpy, sel->win);
1262 if(floating != layout->arrange) { 1261 if(layout->arrange != floating) {
1263 wc.stack_mode = Below; 1262 wc.stack_mode = Below;
1264 wc.sibling = barwin; 1263 wc.sibling = barwin;
1265 if(!sel->isfloating) { 1264 if(!sel->isfloating) {
@@ -1396,9 +1395,9 @@ setmwfact(const char *arg) {
1396 if(!domwfact) 1395 if(!domwfact)
1397 return; 1396 return;
1398 /* arg handling, manipulate mwfact */ 1397 /* arg handling, manipulate mwfact */
1399 if(NULL == arg) 1398 if(arg == NULL)
1400 mwfact = MWFACT; 1399 mwfact = MWFACT;
1401 else if(1 == sscanf(arg, "%lf", &delta)) { 1400 else if(sscanf(arg, "%lf", &delta) == 1) {
1402 if(arg[0] == '+' || arg[0] == '-') 1401 if(arg[0] == '+' || arg[0] == '-')
1403 mwfact += delta; 1402 mwfact += delta;
1404 else 1403 else
@@ -1513,8 +1512,8 @@ spawn(const char *arg) {
1513 return; 1512 return;
1514 /* The double-fork construct avoids zombie processes and keeps the code 1513 /* The double-fork construct avoids zombie processes and keeps the code
1515 * clean from stupid signal handlers. */ 1514 * clean from stupid signal handlers. */
1516 if(0 == fork()) { 1515 if(fork() == 0) {
1517 if(0 == fork()) { 1516 if(fork() == 0) {
1518 if(dpy) 1517 if(dpy)
1519 close(ConnectionNumber(dpy)); 1518 close(ConnectionNumber(dpy));
1520 setsid(); 1519 setsid();
@@ -1575,7 +1574,7 @@ tile(void) {
1575 nw = 0; /* gcc stupidity requires this */ 1574 nw = 0; /* gcc stupidity requires this */
1576 for(i = 0, c = mc = nexttiled(clients); c; c = nexttiled(c->next), i++) { 1575 for(i = 0, c = mc = nexttiled(clients); c; c = nexttiled(c->next), i++) {
1577 c->ismax = False; 1576 c->ismax = False;
1578 if(0 == i) { /* master */ 1577 if(i == 0) { /* master */
1579 nw = mw - 2 * c->border; 1578 nw = mw - 2 * c->border;
1580 nh = wah - 2 * c->border; 1579 nh = wah - 2 * c->border;
1581 } 1580 }
@@ -1626,7 +1625,7 @@ togglemax(const char *arg) {
1626 if(!sel || sel->isfixed) 1625 if(!sel || sel->isfixed)
1627 return; 1626 return;
1628 if((sel->ismax = !sel->ismax)) { 1627 if((sel->ismax = !sel->ismax)) {
1629 if((floating == layout->arrange) || sel->isfloating) 1628 if((layout->arrange == floating) || sel->isfloating)
1630 sel->wasfloating = True; 1629 sel->wasfloating = True;
1631 else { 1630 else {
1632 togglefloating(NULL); 1631 togglefloating(NULL);