--- cmd/wmii/Makefile.orig 2007-11-16 13:59:15 UTC +++ cmd/wmii/Makefile @@ -8,8 +8,16 @@ TARG = wmii HFILES= dat.h fns.h x11.h LIB = ${LIBIXP} -LDFLAGS += -lm ${LIBX11} -lXext ${LIBICONV} -lregexp9 -lbio -lfmt -lutf -CFLAGS += ${INCX11} ${INCICONV} -DVERSION=\"${VERSION}\" +LDFLAGS += -lm ${LIBX11} -lXext -lregexp9 -lbio -lfmt -lutf +CFLAGS += ${INCX11} -DVERSION=\"${VERSION}\" + +.ifdef NO_UTF8 +CFLAGS += -DNO_UTF8 +.else +LDFLAGS += ${LIBICONV} +CFLAGS += ${INCICONV} +.endif + OBJ = area \ bar \ client \ --- cmd/wmii/utf.c.orig 2007-11-16 13:59:15 UTC +++ cmd/wmii/utf.c @@ -1,12 +1,17 @@ /* Public Domain --Kris Maglione */ #include "dat.h" #include +#ifndef NO_UTF8 #include +#endif #include #include "fns.h" char* toutf8n(char *str, size_t nstr) { +#ifdef NO_UTF8 + return strndup(str, nstr); +#else static iconv_t cd; char *buf, *pos; size_t nbuf, bsize; @@ -30,6 +35,7 @@ toutf8n(char *str, size_t nstr) { break; *pos = '\0'; return buf; +#endif } char* --- cmd/wmii/x11.c.orig 2007-11-16 13:59:15 UTC +++ cmd/wmii/x11.c @@ -18,6 +18,12 @@ static Map wmap, amap; static MapEnt *wbucket[137]; static MapEnt *abucket[137]; +#ifdef NO_UTF8 +#define XTEXT(func) Xmb##func +#else +#define XTEXT(func) Xutf8##func +#endif + XRectangle XRect(Rectangle r) { XRectangle xr; @@ -444,7 +450,7 @@ drawstring(Image *dst, Font *font, setgccol(dst, col); if(font->set) - Xutf8DrawString(display, dst->image, + XTEXT(DrawString)(display, dst->image, font->set, dst->gc, x, y, buf, len); @@ -552,7 +558,7 @@ textwidth_l(Font *font, char *text, uint XRectangle r; if(font->set) { - Xutf8TextExtents(font->set, text, len, &r, nil); + XTEXT(TextExtents)(font->set, text, len, &r, nil); return r.width; } return XTextWidth(font->xfont, text, len); @@ -638,7 +644,7 @@ gettextlistproperty(Window *w, char *nam XGetTextProperty(display, w->w, &prop, xatom(name)); if(prop.nitems > 0) { - if(Xutf8TextPropertyToTextList(display, &prop, &list, &n) == Success) + if(XTEXT(TextPropertyToTextList)(display, &prop, &list, &n) == Success) *ret = list; XFree(prop.value); } @@ -653,9 +659,10 @@ gettextproperty(Window *w, char *name) { str = nil; n = gettextlistproperty(w, name, &list); - if(n > 0) + if(n > 0 && list) { str = estrdup(*list); - freestringlist(list); + freestringlist(list); + } return str; }