diff --git a/src/client.c b/src/client.c index 1722b88..6188bac 100644 --- a/src/client.c +++ b/src/client.c @@ -623,24 +623,24 @@ client_geo_hints(struct geo *g, int *s) bool client_winsize(struct client *c, struct geo *g) { - int ow; + int ow, oh; struct geo og = c->wgeo; /* Window geo */ c->wgeo.x = c->border; c->wgeo.y = c->tbarw; - c->wgeo.h = g->h - (c->border + c->tbarw); + c->wgeo.h = oh = g->h - (c->border + c->tbarw); c->wgeo.w = ow = g->w - (c->border << 1); client_geo_hints(&c->wgeo, (int*)c->sizeh); /* Check possible problem for tile integration */ - if(g->w < c->sizeh[MINW] || g->h < c->sizeh[MINH] - || c->wgeo.h > g->h || c->wgeo.w > g->w) - { - c->wgeo = og; - return true; - } + if(ow < c->sizeh[MINW] || oh < c->sizeh[MINH]) + if(ow + oh < og.w + og.h) + { + c->wgeo = og; + return true; + } /* Balance position with new size */ c->wgeo.x += (ow - c->wgeo.w) >> 1; @@ -886,6 +886,25 @@ client_fac_resize(struct client *c, enum position p, int fac) XUngrabKeyboard(W->dpy, CurrentTime); } +inline void +client_fac_hint(struct client *c) +{ + int w = c->sizeh[MINW] + c->border + c->border; + int h = c->sizeh[MINH] + c->tbarw + c->border; + + if(c->geo.w < w) + _fac_resize(c, Right, (w - c->geo.w)); + if(c->tgeo.w < w) + _fac_resize(c, Left, (w - c->tgeo.w)); + + if(c->geo.h < h) + _fac_resize(c, Top, (h - c->geo.h)); + if(c->tgeo.h < h) + _fac_resize(c, Bottom, (h - c->tgeo.h)); + + client_apply_tgeo(c->tag); +} + void client_remove(struct client *c) { diff --git a/src/client.h b/src/client.h index f4462b2..5ac23fd 100644 --- a/src/client.h +++ b/src/client.h @@ -30,6 +30,7 @@ void client_remove(struct client *c); void client_free(void); void _fac_resize(struct client *c, enum position p, int fac); void client_apply_tgeo(struct tag *t); +inline void client_fac_hint(struct client *c); /* Generated */ void uicb_client_resize_Right(Uicb); diff --git a/src/layout.c b/src/layout.c index 0b144b0..270b6eb 100644 --- a/src/layout.c +++ b/src/layout.c @@ -382,6 +382,9 @@ layout_split_integrate(struct client *c, struct client *sc) client_moveresize(c, &g); client_moveresize(sc, &sc->geo); + client_fac_hint(c); + client_fac_hint(sc); + layout_save_set(c->tag); }