+
+ /* make response appear more WM_SIZE_HINTS-compliant */
+ if (win->sh_mask)
+ DNPRINTF(SWM_D_MISC, "config_win: hints: window: 0x%lx,"
+ " sh_mask: %ld, min: %d x %d, max: %d x %d, inc: "
+ "%d x %d\n", win->id, win->sh_mask, SH_MIN_W(win),
+ SH_MIN_H(win), SH_MAX_W(win), SH_MAX_H(win),
+ SH_INC_W(win), SH_INC_H(win));
+
+ /* min size */
+ if (SH_MIN(win)) {
+ /* the hint may be set... to 0! */
+ if (SH_MIN_W(win) > 0 && ce.width < SH_MIN_W(win))
+ ce.width = SH_MIN_W(win);
+ if (SH_MIN_H(win) > 0 && ce.height < SH_MIN_H(win))
+ ce.height = SH_MIN_H(win);
+ }
+
+ /* max size */
+ if (SH_MAX(win)) {
+ /* may also be advertized as 0 */
+ if (SH_MAX_W(win) > 0 && ce.width > SH_MAX_W(win))
+ ce.width = SH_MAX_W(win);
+ if (SH_MAX_H(win) > 0 && ce.height > SH_MAX_H(win))
+ ce.height = SH_MAX_H(win);
+ }
+
+ /* resize increment. */
+ if (SH_INC(win)) {
+ if (SH_INC_W(win) > 1 && ce.width > SH_INC_W(win))
+ ce.width -= (ce.width - SH_MIN_W(win)) %
+ SH_INC_W(win);
+ if (SH_INC_H(win) > 1 && ce.height > SH_INC_H(win))
+ ce.height -= (ce.height - SH_MIN_H(win)) %
+ SH_INC_H(win);
+ }
+