comparison draw.c @ 124:75576e44c1d8

made status bar drawing more robust, implemented togglemax and togglemode, works quite well
author arg@10ksloc.org
date Thu, 20 Jul 2006 15:07:35 +0200
parents 61490330e90a
children 9b9deafa0508
comparison
equal deleted inserted replaced
123:61490330e90a 124:75576e44c1d8
105 } 105 }
106 106
107 void 107 void
108 drawstatus() 108 drawstatus()
109 { 109 {
110 int i; 110 int i, x;
111 Bool istile = arrange == dotile; 111 Bool istile = arrange == dotile;
112 112
113 dc.x = dc.y = 0; 113 dc.x = dc.y = 0;
114 dc.w = bw; 114 dc.w = bw;
115 drawtext(NULL, !istile, False); 115 drawtext(NULL, !istile, False);
121 if(istile) 121 if(istile)
122 drawtext(tags[i], (i == tsel), True); 122 drawtext(tags[i], (i == tsel), True);
123 else 123 else
124 drawtext(tags[i], (i != tsel), True); 124 drawtext(tags[i], (i != tsel), True);
125 } 125 }
126 if(sel) { 126 x = dc.x + dc.w;
127 dc.x += dc.w;
128 dc.w = textw(sel->name);
129 drawtext(sel->name, istile, True);
130 }
131 dc.w = textw(stext); 127 dc.w = textw(stext);
132 dc.x = bx + bw - dc.w; 128 dc.x = bx + bw - dc.w;
133 drawtext(stext, !istile, False); 129 drawtext(stext, !istile, False);
134 130 if(sel && ((dc.w = dc.x - x) >= bh)) {
131 dc.x = x;
132 drawtext(sel->name, istile, True);
133 }
135 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); 134 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
136 XSync(dpy, False); 135 XSync(dpy, False);
137 } 136 }
138 137
139 void 138 void