implemented right tag drawing in the status bar and titlebars
This commit is contained in:
parent
b739721d9e
commit
af1158d105
2 changed files with 23 additions and 10 deletions
27
draw.c
27
draw.c
|
@ -125,10 +125,22 @@ drawstatus()
|
||||||
dc.w = textw(stext);
|
dc.w = textw(stext);
|
||||||
dc.x = bx + bw - dc.w;
|
dc.x = bx + bw - dc.w;
|
||||||
drawtext(stext, !istile);
|
drawtext(stext, !istile);
|
||||||
if(sel && ((dc.w = dc.x - x) >= bh)) {
|
|
||||||
|
if(sel) {
|
||||||
|
for(i = 0; i < ntags; i++)
|
||||||
|
if(sel->tags[i]) {
|
||||||
|
dc.w = textw(tags[i]);
|
||||||
|
dc.x -= dc.w;
|
||||||
|
if(dc.x < x)
|
||||||
|
break;
|
||||||
|
drawtext(tags[i], istile);
|
||||||
|
}
|
||||||
|
if(dc.x > x && (dc.x - x) > bh) {
|
||||||
|
dc.w = dc.x - x;
|
||||||
dc.x = x;
|
dc.x = x;
|
||||||
drawtext(sel->name, istile);
|
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);
|
||||||
}
|
}
|
||||||
|
@ -149,17 +161,16 @@ drawtitle(Client *c)
|
||||||
XSetWindowBorder(dpy, c->win, dc.bg);
|
XSetWindowBorder(dpy, c->win, dc.bg);
|
||||||
XMapWindow(dpy, c->title);
|
XMapWindow(dpy, c->title);
|
||||||
|
|
||||||
dc.x = dc.y = 0;
|
dc.y = dc.w = 0;
|
||||||
dc.w = 0;
|
dc.x = c->tw;
|
||||||
for(i = 0; i < ntags; i++) {
|
for(i = 0; i < ntags; i++)
|
||||||
if(c->tags[i]) {
|
if(c->tags[i]) {
|
||||||
dc.x += dc.w;
|
|
||||||
dc.w = textw(tags[i]);
|
dc.w = textw(tags[i]);
|
||||||
|
dc.x -= dc.w;
|
||||||
drawtext(tags[i], !istile);
|
drawtext(tags[i], !istile);
|
||||||
}
|
}
|
||||||
}
|
dc.w = dc.x;
|
||||||
dc.x += dc.w;
|
dc.x = 0;
|
||||||
dc.w = c->tw - dc.x;
|
|
||||||
drawtext(c->name, !istile);
|
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);
|
||||||
|
|
2
tag.c
2
tag.c
|
@ -122,6 +122,8 @@ tag(Arg *arg)
|
||||||
settitle(sel);
|
settitle(sel);
|
||||||
if(!isvisible(sel))
|
if(!isvisible(sel))
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
|
else
|
||||||
|
drawstatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue