comparison 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
comparison
equal deleted inserted replaced
339:5c874c619287 340:ae0affabdc02
123 } 123 }
124 x = dc.x + dc.w; 124 x = dc.x + dc.w;
125 dc.w = textw(stext); 125 dc.w = textw(stext);
126 dc.x = bx + bw - dc.w; 126 dc.x = bx + bw - dc.w;
127 drawtext(stext, !istile); 127 drawtext(stext, !istile);
128 if(sel && ((dc.w = dc.x - x) >= bh)) { 128
129 dc.x = x; 129 if(sel) {
130 drawtext(sel->name, istile); 130 for(i = 0; i < ntags; i++)
131 if(sel->tags[i]) {
132 dc.w = textw(tags[i]);
133 dc.x -= dc.w;
134 if(dc.x < x)
135 break;
136 drawtext(tags[i], istile);
137 }
138 if(dc.x > x && (dc.x - x) > bh) {
139 dc.w = dc.x - x;
140 dc.x = x;
141 drawtext(sel->name, istile);
142 }
131 } 143 }
132 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); 144 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
133 XSync(dpy, False); 145 XSync(dpy, False);
134 } 146 }
135 147
147 } 159 }
148 160
149 XSetWindowBorder(dpy, c->win, dc.bg); 161 XSetWindowBorder(dpy, c->win, dc.bg);
150 XMapWindow(dpy, c->title); 162 XMapWindow(dpy, c->title);
151 163
152 dc.x = dc.y = 0; 164 dc.y = dc.w = 0;
153 dc.w = 0; 165 dc.x = c->tw;
154 for(i = 0; i < ntags; i++) { 166 for(i = 0; i < ntags; i++)
155 if(c->tags[i]) { 167 if(c->tags[i]) {
156 dc.x += dc.w;
157 dc.w = textw(tags[i]); 168 dc.w = textw(tags[i]);
169 dc.x -= dc.w;
158 drawtext(tags[i], !istile); 170 drawtext(tags[i], !istile);
159 } 171 }
160 } 172 dc.w = dc.x;
161 dc.x += dc.w; 173 dc.x = 0;
162 dc.w = c->tw - dc.x;
163 drawtext(c->name, !istile); 174 drawtext(c->name, !istile);
164 XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0); 175 XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0);
165 XSync(dpy, False); 176 XSync(dpy, False);
166 } 177 }
167 178