From 370adc94e7b45eaeca58321ad340f2a420238816 Mon Sep 17 00:00:00 2001 From: David Maciejak Date: Wed, 15 Feb 2023 19:13:53 +0800 Subject: [PATCH] Ignore WM_NORMAL_HINTS resize increment for maximized windows If you are trying to maximize old apps that are setting a resize increment in term of WM_NORMAL_HINTS notion the window will not be maximized fully (by a few pixels). It's easy to reproduce with xterm, ctrl double click on the title bar. xprop extract sample is giving: program specified resize increment: 6 by 13 For those maximized windows the patch is just ignoring the resize increment. Seems the same issue happened on that project https://github.com/paperwm/PaperWM/issues/106 --- src/window.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/window.c b/src/window.c index bf6e6e39..2305bd32 100644 --- a/src/window.c +++ b/src/window.c @@ -1858,8 +1858,10 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe int baseH = 0; if (wwin->normal_hints) { - winc = wwin->normal_hints->width_inc; - hinc = wwin->normal_hints->height_inc; + if (!wwin->flags.maximized) { + winc = wwin->normal_hints->width_inc; + hinc = wwin->normal_hints->height_inc; + } minW = wwin->normal_hints->min_width; minH = wwin->normal_hints->min_height; maxW = wwin->normal_hints->max_width; @@ -1922,15 +1924,17 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe } } - if (baseW != 0) - width = (((width - baseW) / winc) * winc) + baseW; - else - width = (((width - minW) / winc) * winc) + minW; + if (!wwin->flags.maximized) { + if (baseW != 0) + width = (((width - baseW) / winc) * winc) + baseW; + else + width = (((width - minW) / winc) * winc) + minW; - if (baseH != 0) - height = (((height - baseH) / hinc) * hinc) + baseH; - else - height = (((height - minH) / hinc) * hinc) + minH; + if (baseH != 0) + height = (((height - baseH) / hinc) * hinc) + baseH; + else + height = (((height - minH) / hinc) * hinc) + minH; + } /* broken stupid apps may cause preposterous values for these.. */ if (width > 0)