dwm-meillo
diff draw.c @ 340:ae0affabdc02
implemented right tag drawing in the status bar and titlebars
author | Anselm R. Garbe <arg@10kloc.org> |
---|---|
date | Wed, 23 Aug 2006 14:38:25 +0200 |
parents | 5cfa63564a0f |
children | a1901753deef |
line diff
1.1 --- a/draw.c Wed Aug 23 13:04:43 2006 +0200 1.2 +++ b/draw.c Wed Aug 23 14:38:25 2006 +0200 1.3 @@ -125,9 +125,21 @@ 1.4 dc.w = textw(stext); 1.5 dc.x = bx + bw - dc.w; 1.6 drawtext(stext, !istile); 1.7 - if(sel && ((dc.w = dc.x - x) >= bh)) { 1.8 - dc.x = x; 1.9 - drawtext(sel->name, istile); 1.10 + 1.11 + if(sel) { 1.12 + for(i = 0; i < ntags; i++) 1.13 + if(sel->tags[i]) { 1.14 + dc.w = textw(tags[i]); 1.15 + dc.x -= dc.w; 1.16 + if(dc.x < x) 1.17 + break; 1.18 + drawtext(tags[i], istile); 1.19 + } 1.20 + if(dc.x > x && (dc.x - x) > bh) { 1.21 + dc.w = dc.x - x; 1.22 + dc.x = x; 1.23 + drawtext(sel->name, istile); 1.24 + } 1.25 } 1.26 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); 1.27 XSync(dpy, False); 1.28 @@ -149,17 +161,16 @@ 1.29 XSetWindowBorder(dpy, c->win, dc.bg); 1.30 XMapWindow(dpy, c->title); 1.31 1.32 - dc.x = dc.y = 0; 1.33 - dc.w = 0; 1.34 - for(i = 0; i < ntags; i++) { 1.35 + dc.y = dc.w = 0; 1.36 + dc.x = c->tw; 1.37 + for(i = 0; i < ntags; i++) 1.38 if(c->tags[i]) { 1.39 - dc.x += dc.w; 1.40 dc.w = textw(tags[i]); 1.41 + dc.x -= dc.w; 1.42 drawtext(tags[i], !istile); 1.43 } 1.44 - } 1.45 - dc.x += dc.w; 1.46 - dc.w = c->tw - dc.x; 1.47 + dc.w = dc.x; 1.48 + dc.x = 0; 1.49 drawtext(c->name, !istile); 1.50 XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0); 1.51 XSync(dpy, False);