X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;ds=sidebyside;f=dmenu.c;h=c0addad867c5229e40edc3b2074966fffbc2f641;hb=bab59a980716e5f210f27e92b11a53517412bc5f;hp=d0c63db313a62716f0c4530ad28887e40a13e371;hpb=c24f22a36bb986287f2b53116dff6479c434bc7d;p=dmenu.git diff --git a/dmenu.c b/dmenu.c index d0c63db..c0addad 100644 --- a/dmenu.c +++ b/dmenu.c @@ -1,6 +1,7 @@ /* See LICENSE file for copyright and license details. */ #define _BSD_SOURCE #include +#include #include #include #include @@ -78,7 +79,7 @@ static unsigned int mw, mh; static unsigned int numlockmask = 0; static Bool running = True; static Display *dpy; -static DC dc = {0}; +static DC dc; static Item *allitems = NULL; /* first of all items */ static Item *item = NULL; /* first of pattern matching items */ static Item *sel = NULL; @@ -299,9 +300,6 @@ initfont(const char *fontstr) { } } else { - if(dc.font.xfont) - XFreeFont(dpy, dc.font.xfont); - dc.font.xfont = NULL; if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr)) && !(dc.font.xfont = XLoadQueryFont(dpy, "fixed"))) eprint("error, cannot load font: '%s'\n", fontstr); @@ -705,7 +703,7 @@ main(int argc, char *argv[]) { else eprint("usage: dmenu [-i] [-b] [-fn ] [-nb ] [-nf ]\n" " [-p ] [-sb ] [-sf ] [-v]\n"); - if(!XSupportsLocale()) + if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) fprintf(stderr, "warning: no locale support\n"); if(!(dpy = XOpenDisplay(0))) eprint("dmenu: cannot open display\n");