* To understand everything else, start reading main().
*/
#include <errno.h>
+#include <locale.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
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;
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)))