summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--draw.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/draw.c b/draw.c
index 16f934d..5d19bfb 100644
--- a/draw.c
+++ b/draw.c
@@ -42,7 +42,7 @@ textnw(const char *text, unsigned int len)
42} 42}
43 43
44static void 44static void
45drawtext(const char *text, Bool invert, Bool border) 45drawtext(const char *text, Bool invert)
46{ 46{
47 int x, y, w, h; 47 int x, y, w, h;
48 static char buf[256]; 48 static char buf[256];
@@ -52,14 +52,12 @@ drawtext(const char *text, Bool invert, Bool border)
52 52
53 XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); 53 XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg);
54 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); 54 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
55 55 drawborder();
56 w = 0;
57 if(border)
58 drawborder();
59 56
60 if(!text) 57 if(!text)
61 return; 58 return;
62 59
60 w = 0;
63 len = strlen(text); 61 len = strlen(text);
64 if(len >= sizeof(buf)) 62 if(len >= sizeof(buf))
65 len = sizeof(buf) - 1; 63 len = sizeof(buf) - 1;
@@ -111,24 +109,24 @@ drawstatus()
111 109
112 dc.x = dc.y = 0; 110 dc.x = dc.y = 0;
113 dc.w = bw; 111 dc.w = bw;
114 drawtext(NULL, !istile, False); 112 drawtext(NULL, !istile);
115 113
116 dc.w = 0; 114 dc.w = 0;
117 for(i = 0; i < ntags; i++) { 115 for(i = 0; i < ntags; i++) {
118 dc.x += dc.w; 116 dc.x += dc.w;
119 dc.w = textw(tags[i]); 117 dc.w = textw(tags[i]);
120 if(istile) 118 if(istile)
121 drawtext(tags[i], (i == tsel), True); 119 drawtext(tags[i], (i == tsel));
122 else 120 else
123 drawtext(tags[i], (i != tsel), True); 121 drawtext(tags[i], (i != tsel));
124 } 122 }
125 x = dc.x + dc.w; 123 x = dc.x + dc.w;
126 dc.w = textw(stext); 124 dc.w = textw(stext);
127 dc.x = bx + bw - dc.w; 125 dc.x = bx + bw - dc.w;
128 drawtext(stext, !istile, True); 126 drawtext(stext, !istile);
129 if(sel && ((dc.w = dc.x - x) >= bh)) { 127 if(sel && ((dc.w = dc.x - x) >= bh)) {
130 dc.x = x; 128 dc.x = x;
131 drawtext(sel->name, istile, True); 129 drawtext(sel->name, istile);
132 } 130 }
133 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); 131 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
134 XSync(dpy, False); 132 XSync(dpy, False);
@@ -157,12 +155,12 @@ drawtitle(Client *c)
157 if(c->tags[i]) { 155 if(c->tags[i]) {
158 dc.x += dc.w; 156 dc.x += dc.w;
159 dc.w = textw(tags[i]); 157 dc.w = textw(tags[i]);
160 drawtext(tags[i], !istile, True); 158 drawtext(tags[i], !istile);
161 } 159 }
162 } 160 }
163 dc.x += dc.w; 161 dc.x += dc.w;
164 dc.w = textw(c->name); 162 dc.w = textw(c->name);
165 drawtext(c->name, !istile, True); 163 drawtext(c->name, !istile);
166 XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0); 164 XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0);
167 XSync(dpy, False); 165 XSync(dpy, False);
168} 166}