X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=draw.c;h=5d19bfb26486f1c9688449f88103393fd9c2ff07;hb=00255728aae0dcbb657e8a4e145515c673b546a4;hp=4ba5cd6dc1e4eaea3bafd41c076a7625c9c79acd;hpb=95e8d12b7189d4cd01b8ae8ecebfa5835a1809e6;p=dwm.git diff --git a/draw.c b/draw.c index 4ba5cd6..5d19bfb 100644 --- a/draw.c +++ b/draw.c @@ -30,7 +30,7 @@ drawborder(void) } static unsigned int -textnw(char *text, unsigned int len) +textnw(const char *text, unsigned int len) { XRectangle r; @@ -42,7 +42,7 @@ textnw(char *text, unsigned int len) } static void -drawtext(const char *text, Bool invert, Bool border) +drawtext(const char *text, Bool invert) { int x, y, w, h; static char buf[256]; @@ -52,14 +52,12 @@ drawtext(const char *text, Bool invert, Bool border) XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); - - w = 0; - if(border) - drawborder(); + drawborder(); if(!text) return; + w = 0; len = strlen(text); if(len >= sizeof(buf)) len = sizeof(buf) - 1; @@ -111,24 +109,24 @@ drawstatus() dc.x = dc.y = 0; dc.w = bw; - drawtext(NULL, !istile, False); + drawtext(NULL, !istile); dc.w = 0; - for(i = 0; i < TLast; i++) { + for(i = 0; i < ntags; i++) { dc.x += dc.w; dc.w = textw(tags[i]); if(istile) - drawtext(tags[i], (i == tsel), True); + drawtext(tags[i], (i == tsel)); else - drawtext(tags[i], (i != tsel), True); + drawtext(tags[i], (i != tsel)); } x = dc.x + dc.w; dc.w = textw(stext); dc.x = bx + bw - dc.w; - drawtext(stext, !istile, False); + drawtext(stext, !istile); if(sel && ((dc.w = dc.x - x) >= bh)) { dc.x = x; - drawtext(sel->name, istile, True); + drawtext(sel->name, istile); } XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); XSync(dpy, False); @@ -153,16 +151,16 @@ drawtitle(Client *c) dc.x = dc.y = 0; dc.w = 0; - for(i = 0; i < TLast; i++) { + for(i = 0; i < ntags; i++) { if(c->tags[i]) { dc.x += dc.w; - dc.w = textw(c->tags[i]); - drawtext(c->tags[i], !istile, True); + dc.w = textw(tags[i]); + drawtext(tags[i], !istile); } } dc.x += dc.w; dc.w = textw(c->name); - drawtext(c->name, !istile, True); + drawtext(c->name, !istile); XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0); XSync(dpy, False); } @@ -229,7 +227,7 @@ setfont(const char *fontstr) } unsigned int -textw(char *text) +textw(const char *text) { return textnw(text, strlen(text)) + dc.font.height; }