On Mon, Apr 24, 2017 at 01:35:59PM +1000, Daniel Cousens wrote:
>    It has often annoyed me that my `st` windows would have "gaps" beneath
>    them and to the right as a result of the size hints not being respected
>    (due to column widths being enforced nicely in `st`)... however, � the
>    annoyance doesn't come from the fact that it happens, � just the lack
>    of symmetry.
>    This patch enforces that symmetry by performing a dummy resize loop
>    first, � then using the aggregate remainder, � it then adds half of
>    that remainder as an initial offset, � leaving symmetric gaps on each
>    axis, not just the positive axis'.
>    This patch has issues though, � for whatever reason Chromium doesn't
>    like this approach whatsoever, � and often refuses to resize at all...
>    Feedback appreciated; � and thoughts if this is a better behaviour?

> From a88d0927d8c64044ea417eea4376c475ec7ecf1c Mon Sep 17 00:00:00 2001
> From: Daniel Cousens <[email protected]>
> Date: Mon, 24 Apr 2017 13:01:46 +1000
> Subject: [PATCH] center windows if useless gaps occur
> 
> ---
>  dwm.c | 37 +++++++++++++++++++++++++++++++++++--
>  1 file changed, 35 insertions(+), 2 deletions(-)
> 
> diff --git a/dwm.c b/dwm.c
> index b452ed7..9baf58b 100644
> --- a/dwm.c
> +++ b/dwm.c
> @@ -1266,6 +1266,22 @@ resize(Client *c, int x, int y, int w, int h, int 
> interact)
>  }
>  
>  void
> +dummyresizeclient(Client *c, int x, int y, int w, int h)
> +{
> +     c->x = x;
> +     c->y = y;
> +     c->w = w;
> +     c->h = h;
> +}
> +
> +void
> +dummyresize(Client *c, int x, int y, int w, int h, int interact)
> +{
> +     if (applysizehints(c, &x, &y, &w, &h, interact))
> +             dummyresizeclient(c, x, y, w, h);
> +}
> +
> +void
>  resizeclient(Client *c, int x, int y, int w, int h)
>  {
>       XWindowChanges wc;
> @@ -1667,6 +1683,7 @@ void
>  tile(Monitor *m)
>  {
>       unsigned int i, n, h, mw, my, ty;
> +     unsigned int dx = 0;
>       Client *c;
>  
>       for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
> @@ -1677,14 +1694,30 @@ tile(Monitor *m)
>               mw = m->nmaster ? m->ww * m->mfact : 0;
>       else
>               mw = m->ww;
> +
> +     /* dummy tile, for size hints only */
>       for (i = my = ty = 0, c = nexttiled(m->clients); c; c = 
> nexttiled(c->next), i++)
>               if (i < m->nmaster) {
>                       h = (m->wh - my) / (MIN(n, m->nmaster) - i);
> -                     resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - 
> (2*c->bw), 0);
> +                     dummyresize(c, m->wx, m->wy + my, mw - (2*c->bw), h - 
> (2*c->bw), 0);
>                       my += HEIGHT(c);
>               } else {
>                       h = (m->wh - ty) / (n - i);
> -                     resize(c, m->wx + mw, m->wy + ty, m->ww - mw - 
> (2*c->bw), h - (2*c->bw), 0);
> +                     dummyresize(c, m->wx + mw, m->wy + ty, m->ww - mw - 
> (2*c->bw), h - (2*c->bw), 0);
> +                     ty += HEIGHT(c);
> +             }
> +
> +     my = (m->wh - my) / 2;
> +     ty = (m->wh - ty) / 2;
> +
> +     for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
> +             if (i < m->nmaster) {
> +                     dx = ((mw - (2*c->bw)) - WIDTH(c)) / 2;
> +                     resize(c, m->wx + dx, m->wy + my, WIDTH(c), HEIGHT(c), 
> 0);
> +                     my += HEIGHT(c);
> +             } else {
> +                     dx = ((m->ww - mw - (2*c->bw)) - WIDTH(c)) / 2;
> +                     resize(c, m->wx + mw + dx, m->wy + ty, WIDTH(c), 
> HEIGHT(c), 0);
>                       ty += HEIGHT(c);
>               }
>  }
> -- 
> 2.12.2
> 

Hey,

Sorry if I'm missing the point, but have you tried the config option
"resizehints" in dwm?

(Firefox also has issues with initial window resize, it is a Firefox
bug I think).

-- 
Kind regards,
Hiltjo

Reply via email to