draw.c
changeset 273 ffc73b32084a
parent 269 bf6792e3e700
child 331 0ed2de01e9f7
equal deleted inserted replaced
272:be40a56df248 273:ffc73b32084a
    63 
    63 
    64 	/* shorten text if necessary */
    64 	/* shorten text if necessary */
    65 	while(len && (w = textnw(buf, len)) > dc.w - h)
    65 	while(len && (w = textnw(buf, len)) > dc.w - h)
    66 		buf[--len] = 0;
    66 		buf[--len] = 0;
    67 	if(len < olen) {
    67 	if(len < olen) {
       
    68 		if(len > 1)
       
    69 			buf[len - 1] = '.';
       
    70 		if(len > 2)
       
    71 			buf[len - 2] = '.';
    68 		if(len > 3)
    72 		if(len > 3)
    69 			memcpy(buf + len - 4, "...\0", 4);
    73 			buf[len - 3] = '.';
    70 		else if(len > 2)
       
    71 			memcpy(buf + len - 3, "..\0", 3);
       
    72 		else if(len > 1)
       
    73 			memcpy(buf + len - 2, ".\0", 2);
       
    74 	}
    74 	}
    75 
    75 
    76 	if(w > dc.w)
    76 	if(w > dc.w)
    77 		return; /* too long */
    77 		return; /* too long */
    78 
    78 
   158 			dc.w = textw(tags[i]);
   158 			dc.w = textw(tags[i]);
   159 			drawtext(tags[i], !istile);
   159 			drawtext(tags[i], !istile);
   160 		}
   160 		}
   161 	}
   161 	}
   162 	dc.x += dc.w;
   162 	dc.x += dc.w;
   163 	dc.w = textw(c->name);
   163 	dc.w = c->tw - dc.x;
   164 	drawtext(c->name, !istile);
   164 	drawtext(c->name, !istile);
   165 	XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0);
   165 	XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0);
   166 	XSync(dpy, False);
   166 	XSync(dpy, False);
   167 }
   167 }
   168 
   168