|
|
@ -42,7 +42,7 @@ textnw(const char *text, unsigned int len)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
static void
|
|
|
|
drawtext(const char *text, Bool invert, Bool border)
|
|
|
|
drawtext(const char *text, Bool invert)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int x, y, w, h;
|
|
|
|
int x, y, w, h;
|
|
|
|
static char buf[256];
|
|
|
|
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);
|
|
|
|
XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg);
|
|
|
|
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
|
|
|
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
|
|
|
|
|
|
|
|
|
|
|
w = 0;
|
|
|
|
|
|
|
|
if(border)
|
|
|
|
|
|
|
|
drawborder();
|
|
|
|
drawborder();
|
|
|
|
|
|
|
|
|
|
|
|
if(!text)
|
|
|
|
if(!text)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
w = 0;
|
|
|
|
len = strlen(text);
|
|
|
|
len = strlen(text);
|
|
|
|
if(len >= sizeof(buf))
|
|
|
|
if(len >= sizeof(buf))
|
|
|
|
len = sizeof(buf) - 1;
|
|
|
|
len = sizeof(buf) - 1;
|
|
|
@ -111,24 +109,24 @@ drawstatus()
|
|
|
|
|
|
|
|
|
|
|
|
dc.x = dc.y = 0;
|
|
|
|
dc.x = dc.y = 0;
|
|
|
|
dc.w = bw;
|
|
|
|
dc.w = bw;
|
|
|
|
drawtext(NULL, !istile, False);
|
|
|
|
drawtext(NULL, !istile);
|
|
|
|
|
|
|
|
|
|
|
|
dc.w = 0;
|
|
|
|
dc.w = 0;
|
|
|
|
for(i = 0; i < ntags; i++) {
|
|
|
|
for(i = 0; i < ntags; i++) {
|
|
|
|
dc.x += dc.w;
|
|
|
|
dc.x += dc.w;
|
|
|
|
dc.w = textw(tags[i]);
|
|
|
|
dc.w = textw(tags[i]);
|
|
|
|
if(istile)
|
|
|
|
if(istile)
|
|
|
|
drawtext(tags[i], (i == tsel), True);
|
|
|
|
drawtext(tags[i], (i == tsel));
|
|
|
|
else
|
|
|
|
else
|
|
|
|
drawtext(tags[i], (i != tsel), True);
|
|
|
|
drawtext(tags[i], (i != tsel));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
x = dc.x + dc.w;
|
|
|
|
x = dc.x + dc.w;
|
|
|
|
dc.w = textw(stext);
|
|
|
|
dc.w = textw(stext);
|
|
|
|
dc.x = bx + bw - dc.w;
|
|
|
|
dc.x = bx + bw - dc.w;
|
|
|
|
drawtext(stext, !istile, True);
|
|
|
|
drawtext(stext, !istile);
|
|
|
|
if(sel && ((dc.w = dc.x - x) >= bh)) {
|
|
|
|
if(sel && ((dc.w = dc.x - x) >= bh)) {
|
|
|
|
dc.x = x;
|
|
|
|
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);
|
|
|
|
XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
|
|
|
|
XSync(dpy, False);
|
|
|
|
XSync(dpy, False);
|
|
|
@ -157,12 +155,12 @@ drawtitle(Client *c)
|
|
|
|
if(c->tags[i]) {
|
|
|
|
if(c->tags[i]) {
|
|
|
|
dc.x += dc.w;
|
|
|
|
dc.x += dc.w;
|
|
|
|
dc.w = textw(tags[i]);
|
|
|
|
dc.w = textw(tags[i]);
|
|
|
|
drawtext(tags[i], !istile, True);
|
|
|
|
drawtext(tags[i], !istile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dc.x += dc.w;
|
|
|
|
dc.x += dc.w;
|
|
|
|
dc.w = textw(c->name);
|
|
|
|
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);
|
|
|
|
XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0);
|
|
|
|
XSync(dpy, False);
|
|
|
|
XSync(dpy, False);
|
|
|
|
}
|
|
|
|
}
|
|
|
|