Gottox' drawtext simplification

This commit is contained in:
Anselm R Garbe 2008-06-01 11:58:19 +01:00
parent c2784e4a38
commit c26e22ccee
2 changed files with 3 additions and 9 deletions

View file

@ -24,7 +24,7 @@ Rule rules[] = {
/* layout(s) */ /* layout(s) */
double mfact = 0.55; double mfact = 0.55;
Bool resizehints = True; /* False means respect size hints in tiled resizals */ Bool resizehints = False; /* False means respect size hints in tiled resizals */
Layout layouts[] = { Layout layouts[] = {
/* symbol arrange function */ /* symbol arrange function */

10
dwm.c
View file

@ -571,14 +571,8 @@ drawtext(const char *text, ulong col[ColLast], Bool invert) {
for(; len && (w = textnw(buf, len)) > dc.w - h; len--); for(; len && (w = textnw(buf, len)) > dc.w - h; len--);
if(!len) if(!len)
return; return;
if(len < olen) { if(len < olen)
if(len > 1) strncpy(&buf[MAX(0, len - 3)], "...", len);
buf[len - 1] = '.';
if(len > 2)
buf[len - 2] = '.';
if(len > 3)
buf[len - 3] = '.';
}
XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]); XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]);
if(dc.font.set) if(dc.font.set)
XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len); XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len);