- XSizeHints size = {
- .flags = PSize | PResizeInc | PBaseSize,
- .height = xw.h,
- .width = xw.w,
- .height_inc = xw.ch,
- .width_inc = xw.cw,
- .base_height = 2*BORDER,
- .base_width = 2*BORDER,
- };
- XSetWMProperties(xw.dpy, xw.win, NULL, NULL, NULL, 0, &size, &wm, &class);
+ XSizeHints *sizeh = NULL;
+
+ sizeh = XAllocSizeHints();
+ if(xw.isfixed == False) {
+ sizeh->flags = PSize | PResizeInc | PBaseSize;
+ sizeh->height = xw.h;
+ sizeh->width = xw.w;
+ sizeh->height_inc = xw.ch;
+ sizeh->width_inc = xw.cw;
+ sizeh->base_height = 2*BORDER;
+ sizeh->base_width = 2*BORDER;
+ } else {
+ sizeh->flags = PMaxSize | PMinSize;
+ sizeh->min_width = sizeh->max_width = xw.fw;
+ sizeh->min_height = sizeh->max_height = xw.fh;
+ }
+
+ XSetWMProperties(xw.dpy, xw.win, NULL, NULL, NULL, 0, sizeh, &wm, &class);
+ XFree(sizeh);