draw.c
changeset 173 1db04019684e
parent 164 21071ae1fe68
child 178 e848966a1ac6
equal deleted inserted replaced
172:af781faa40d6 173:1db04019684e
    28 	points[4].y = -(dc.h - 1);
    28 	points[4].y = -(dc.h - 1);
    29 	XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
    29 	XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
    30 }
    30 }
    31 
    31 
    32 static unsigned int
    32 static unsigned int
    33 textnw(char *text, unsigned int len)
    33 textnw(const char *text, unsigned int len)
    34 {
    34 {
    35 	XRectangle r;
    35 	XRectangle r;
    36 
    36 
    37 	if(dc.font.set) {
    37 	if(dc.font.set) {
    38 		XmbTextExtents(dc.font.set, text, len, NULL, &r);
    38 		XmbTextExtents(dc.font.set, text, len, NULL, &r);
   154 
   154 
   155 	dc.w = 0;
   155 	dc.w = 0;
   156 	for(i = 0; i < TLast; i++) {
   156 	for(i = 0; i < TLast; i++) {
   157 		if(c->tags[i]) {
   157 		if(c->tags[i]) {
   158 			dc.x += dc.w;
   158 			dc.x += dc.w;
   159 			dc.w = textw(c->tags[i]);
   159 			dc.w = textw(tags[i]);
   160 			drawtext(c->tags[i], !istile, True);
   160 			drawtext(tags[i], !istile, True);
   161 		}
   161 		}
   162 	}
   162 	}
   163 	dc.x += dc.w;
   163 	dc.x += dc.w;
   164 	dc.w = textw(c->name);
   164 	dc.w = textw(c->name);
   165 	drawtext(c->name, !istile, True);
   165 	drawtext(c->name, !istile, True);
   227 	}
   227 	}
   228 	dc.font.height = dc.font.ascent + dc.font.descent;
   228 	dc.font.height = dc.font.ascent + dc.font.descent;
   229 }
   229 }
   230 
   230 
   231 unsigned int
   231 unsigned int
   232 textw(char *text)
   232 textw(const char *text)
   233 {
   233 {
   234 	return textnw(text, strlen(text)) + dc.font.height;
   234 	return textnw(text, strlen(text)) + dc.font.height;
   235 }
   235 }