wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 697169213f919c98030e554526db30adb81b2d10
parent 978127964a2b147dd2c47c734cf3430d366b1e3f
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Tue, 28 Feb 2006 17:24:44 +0100

changing check_dimension policy in resize_client (safe to prevent clients from doing weird things)


Diffstat:
cmd/wm/client.c | 23++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -447,16 +447,16 @@ static void check_dimensions(Client *c, unsigned int tabh, unsigned int bw) { if(c->size.flags & PMinSize) { - if(c->frame.rect.width - 2 * bw < c->size.min_width) - c->frame.rect.width = c->size.min_width + 2 * bw; - if(c->frame.rect.height - bw - (tabh ? tabh : bw) < c->size.min_height) - c->frame.rect.height = c->size.min_height + bw + (tabh ? tabh : bw); + if(c->rect.width < c->size.min_width) + c->rect.width = c->size.min_width; + if(c->rect.height < c->size.min_height) + c->rect.height = c->size.min_height; } if(c->size.flags & PMaxSize) { - if(c->frame.rect.width - 2 * bw > c->size.max_width) - c->frame.rect.width = c->size.max_width + 2 * bw; - if(c->frame.rect.height - bw - (tabh ? tabh : bw) > c->size.max_height) - c->frame.rect.height = c->size.max_height + bw + (tabh ? tabh : bw); + if(c->rect.width > c->size.max_width) + c->rect.width = c->size.max_width; + if(c->rect.height > c->size.max_height) + c->rect.height = c->size.max_height; } } @@ -502,9 +502,6 @@ resize_client(Client *c, XRectangle *r, XPoint *pt) else c->frame.rect = *r; - /* resize if client requests special size */ - check_dimensions(c, bh, bw); - if(def.inc) resize_incremental(c, bh, bw); @@ -515,6 +512,10 @@ resize_client(Client *c, XRectangle *r, XPoint *pt) c->rect.y = bh ? bh : bw; c->rect.width = c->frame.rect.width - 2 * bw; c->rect.height = c->frame.rect.height - bw - (bh ? bh : bw); + + /* resize if client requests special size */ + check_dimensions(c, bh, bw); + XMoveResizeWindow(dpy, c->win, c->rect.x, c->rect.y, c->rect.width, c->rect.height); configure_client(c); }