X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=dwm.c;h=ae2952bf64e383d8f6e574d61feb5cca79d0e85b;hb=db5db8806f4bbb26bb1259f7ea42d7a826517bbb;hp=2bf0ba0be8a365cc81480c554af3404c7f84707a;hpb=85da53785614bcaa626cd1346ce8753291b01760;p=dwm.git diff --git a/dwm.c b/dwm.c index 2bf0ba0..ae2952b 100644 --- a/dwm.c +++ b/dwm.c @@ -781,8 +781,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--) @@ -1048,23 +1046,34 @@ quit(const Arg *arg) { void resize(Client *c, int x, int y, int w, int h, Bool sizehints) { + float a; 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) + a = (float) w/h; + if(a > c->maxa) w = h * c->maxa; - else if(c->mina > (float) h/w) - h = w * c->mina; + else if(a < c->mina) + h = w / c->mina; + } + + if(baseismin) { /* increment calculation requires this */ + w -= c->basew; + h -= c->baseh; } /* adjust for increment value */