summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@10kloc.org>2006-08-23 14:38:25 +0200
committerAnselm R. Garbe <arg@10kloc.org>2006-08-23 14:38:25 +0200
commitaf1158d105ae10469c7a735fcba040b16cea0d60 (patch)
tree1d2e3a88fd6558180fa941df1aabd4d2b5a4755c
parentb739721d9ec56379a55228e8e01b618d5932f6ca (diff)
implemented right tag drawing in the status bar and titlebars
-rw-r--r--draw.c31
-rw-r--r--tag.c2
2 files changed, 23 insertions, 10 deletions
diff --git a/draw.c b/draw.c
index c7ef7f56..96780f0a 100644
--- a/draw.c
+++ b/draw.c
@@ -125,9 +125,21 @@ drawstatus()
dc.w = textw(stext);
dc.x = bx + bw - dc.w;
drawtext(stext, !istile);
- if(sel && ((dc.w = dc.x - x) >= bh)) {
- dc.x = x;
- drawtext(sel->name, istile);
+
+ 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;
+ drawtext(sel->name, istile);
+ }
}
XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
XSync(dpy, False);
@@ -149,17 +161,16 @@ drawtitle(Client *c)
XSetWindowBorder(dpy, c->win, dc.bg);
XMapWindow(dpy, c->title);
- dc.x = dc.y = 0;
- dc.w = 0;
- for(i = 0; i < ntags; i++) {
+ dc.y = dc.w = 0;
+ dc.x = c->tw;
+ for(i = 0; i < ntags; i++)
if(c->tags[i]) {
- dc.x += dc.w;
dc.w = textw(tags[i]);
+ dc.x -= dc.w;
drawtext(tags[i], !istile);
}
- }
- dc.x += dc.w;
- dc.w = c->tw - dc.x;
+ dc.w = dc.x;
+ dc.x = 0;
drawtext(c->name, !istile);
XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0);
XSync(dpy, False);
diff --git a/tag.c b/tag.c
index 512f355f..3a32c521 100644
--- a/tag.c
+++ b/tag.c
@@ -122,6 +122,8 @@ tag(Arg *arg)
settitle(sel);
if(!isvisible(sel))
arrange(NULL);
+ else
+ drawstatus();
}
void