aewl
changeset 66:50450aa24a46
removed a bunch of lines through swap removal
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Fri, 14 Jul 2006 17:43:56 +0200 |
parents | 4f7b232bd72d |
children | a0272d97ec7c |
files | bar.c client.c draw.c dwm.h util.c |
diffstat | 5 files changed, 11 insertions(+), 28 deletions(-) [+] |
line diff
1.1 --- a/bar.c Fri Jul 14 17:30:37 2006 +0200 1.2 +++ b/bar.c Fri Jul 14 17:43:56 2006 +0200 1.3 @@ -25,30 +25,22 @@ 1.4 int i; 1.5 dc.x = dc.y = 0; 1.6 dc.w = bw; 1.7 - drawtext(NULL, False); 1.8 + drawtext(NULL, False, False); 1.9 1.10 dc.w = 0; 1.11 for(i = 0; i < TLast; i++) { 1.12 dc.x += dc.w; 1.13 dc.w = textw(tags[i]) + dc.font.height; 1.14 - if(i == tsel) { 1.15 - swap((void **)&dc.fg, (void **)&dc.bg); 1.16 - drawtext(tags[i], True); 1.17 - swap((void **)&dc.fg, (void **)&dc.bg); 1.18 - } 1.19 - else 1.20 - drawtext(tags[i], True); 1.21 + drawtext(tags[i], i == tsel, True); 1.22 } 1.23 if(sel) { 1.24 - swap((void **)&dc.fg, (void **)&dc.bg); 1.25 dc.x += dc.w; 1.26 dc.w = textw(sel->name) + dc.font.height; 1.27 - drawtext(sel->name, True); 1.28 - swap((void **)&dc.fg, (void **)&dc.bg); 1.29 + drawtext(sel->name, True, True); 1.30 } 1.31 dc.w = textw(stext) + dc.font.height; 1.32 dc.x = bx + bw - dc.w; 1.33 - drawtext(stext, False); 1.34 + drawtext(stext, False, False); 1.35 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); 1.36 XFlush(dpy); 1.37 }
2.1 --- a/client.c Fri Jul 14 17:30:37 2006 +0200 2.2 +++ b/client.c Fri Jul 14 17:43:56 2006 +0200 2.3 @@ -598,12 +598,12 @@ 2.4 if(c->tags[i]) { 2.5 dc.x += dc.w; 2.6 dc.w = textw(c->tags[i]) + dc.font.height; 2.7 - drawtext(c->tags[i], True); 2.8 + drawtext(c->tags[i], False, True); 2.9 } 2.10 } 2.11 dc.x += dc.w; 2.12 dc.w = textw(c->name) + dc.font.height; 2.13 - drawtext(c->name, True); 2.14 + drawtext(c->name, False, True); 2.15 XCopyArea(dpy, dc.drawable, c->title, dc.gc, 2.16 0, 0, c->tw, c->th, 0, 0); 2.17 XFlush(dpy);
3.1 --- a/draw.c Fri Jul 14 17:30:37 2006 +0200 3.2 +++ b/draw.c Fri Jul 14 17:43:56 2006 +0200 3.3 @@ -30,7 +30,7 @@ 3.4 } 3.5 3.6 void 3.7 -drawtext(const char *text, Bool border) 3.8 +drawtext(const char *text, Bool invert, Bool border) 3.9 { 3.10 int x, y, w, h; 3.11 unsigned int len; 3.12 @@ -38,7 +38,7 @@ 3.13 XGCValues gcv; 3.14 XRectangle r = { dc.x, dc.y, dc.w, dc.h }; 3.15 3.16 - XSetForeground(dpy, dc.gc, dc.bg); 3.17 + XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); 3.18 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); 3.19 3.20 w = 0; 3.21 @@ -65,8 +65,8 @@ 3.22 if(w > dc.w) 3.23 return; /* too long */ 3.24 3.25 - gcv.foreground = dc.fg; 3.26 - gcv.background = dc.bg; 3.27 + gcv.foreground = invert ? dc.bg : dc.fg; 3.28 + gcv.background = invert ? dc.fg : dc.bg; 3.29 if(dc.font.set) { 3.30 XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv); 3.31 XmbDrawImageString(dpy, dc.drawable, dc.font.set, dc.gc,
4.1 --- a/dwm.h Fri Jul 14 17:30:37 2006 +0200 4.2 +++ b/dwm.h Fri Jul 14 17:43:56 2006 +0200 4.3 @@ -130,7 +130,7 @@ 4.4 extern void gravitate(Client *c, Bool invert); 4.5 4.6 /* draw.c */ 4.7 -extern void drawtext(const char *text, Bool border); 4.8 +extern void drawtext(const char *text, Bool invert, Bool border); 4.9 extern unsigned long initcolor(const char *colstr); 4.10 extern void initfont(const char *fontstr); 4.11 extern unsigned int textnw(char *text, unsigned int len); 4.12 @@ -153,4 +153,3 @@ 4.13 extern void error(const char *errstr, ...); 4.14 extern void *emallocz(unsigned int size); 4.15 extern void spawn(Arg *arg); 4.16 -extern void swap(void **p1, void **p2);
5.1 --- a/util.c Fri Jul 14 17:30:37 2006 +0200 5.2 +++ b/util.c Fri Jul 14 17:43:56 2006 +0200 5.3 @@ -39,14 +39,6 @@ 5.4 } 5.5 5.6 void 5.7 -swap(void **p1, void **p2) 5.8 -{ 5.9 - void *tmp = *p1; 5.10 - *p1 = *p2; 5.11 - *p2 = tmp; 5.12 -} 5.13 - 5.14 -void 5.15 spawn(Arg *arg) 5.16 { 5.17 char **argv = (char **)arg->argv;