X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;ds=sidebyside;f=dmenu.c;h=d67c1ae8bddd2932e6b0d69332d4fb432d4ccd43;hb=17232f493b07973bacd60abb2e957ccae829eb7e;hp=a9c0f60f048164fa437619070316f4853f9ecacd;hpb=cf7e4c15a97fa4e0921985d8e31bf9d6d4414b9a;p=dmenu.git diff --git a/dmenu.c b/dmenu.c index a9c0f60..d67c1ae 100644 --- a/dmenu.c +++ b/dmenu.c @@ -213,8 +213,8 @@ drawmenu(void) { void drawtext(const char *text, unsigned long col[ColLast]) { - int i, x, y, h, len, olen; char buf[256]; + int i, x, y, h, len, olen; XRectangle r = { dc.x, dc.y, dc.w, dc.h }; XSetForeground(dpy, dc.gc, col[ColBG]); @@ -226,7 +226,7 @@ drawtext(const char *text, unsigned long col[ColLast]) { y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent; x = dc.x + (h / 2); /* shorten text if necessary */ - for(len = MIN(olen, sizeof buf); len && (i = textnw(buf, len)) > dc.w - h; len--); + for(len = MIN(olen, sizeof buf); len && textnw(buf, len) > dc.w - h; len--); if(!len) return; memcpy(buf, text, len);