X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=dwm.c;h=4ea16e008d8ed8eca13784dad2e156a6f6d55908;hb=6411aa921baabd11bfa55eb708bb804dfc6b1375;hp=2bf0ba0be8a365cc81480c554af3404c7f84707a;hpb=85da53785614bcaa626cd1346ce8753291b01760;p=dwm.git diff --git a/dwm.c b/dwm.c index 2bf0ba0..4ea16e0 100644 --- a/dwm.c +++ b/dwm.c @@ -24,6 +24,7 @@ * To understand everything else, start reading main(). */ #include +#include #include #include #include @@ -781,8 +782,6 @@ initfont(const char *fontstr) { int i, n; missing = NULL; - if(dc.font.set) - XFreeFontSet(dpy, dc.font.set); dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def); if(missing) { while(n--) @@ -1051,22 +1050,31 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) { XWindowChanges wc; if(sizehints) { + /* see last two sentences in ICCCM 4.1.2.3 */ + Bool baseismin = c->basew == c->minw && c->baseh == c->minh; + /* set minimum possible */ w = MAX(1, w); h = MAX(1, h); - /* temporarily remove base dimensions */ - w -= c->basew; - h -= c->baseh; + if(!baseismin) { /* temporarily remove base dimensions */ + w -= c->basew; + h -= c->baseh; + } /* adjust for aspect limits */ if(c->mina > 0 && c->maxa > 0) { - if(c->maxa < (float) w/h) + if(c->maxa < (float)(w / h)) w = h * c->maxa; - else if(c->mina > (float) h/w) + else if(c->mina < (float)(h / w)) h = w * c->mina; } + if(baseismin) { /* increment calculation requires this */ + w -= c->basew; + h -= c->baseh; + } + /* adjust for increment value */ if(c->incw) w -= w % c->incw; @@ -1703,7 +1711,7 @@ main(int argc, char *argv[]) { else if(argc != 1) die("usage: dwm [-v]\n"); - if(!XSupportsLocale()) + if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) fprintf(stderr, "warning: no locale support\n"); if(!(dpy = XOpenDisplay(0)))