From 41160e4cdf5f55f74e4e5a6183b70262bea518a7 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Wed, 18 Jun 2008 15:53:08 +0200 Subject: [PATCH] mouse: make float resize work better with sizehints --- mouse.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/mouse.c b/mouse.c index 3cc61d377..05bb07666 100644 --- a/mouse.c +++ b/mouse.c @@ -646,8 +646,40 @@ mouse_client_resize_floating(client_t *c, corner_t corner, bool infobox) XCB_CURRENT_TIME, MOUSEMASK); } + if(globalconf.resize_hints && c->hassizehints) + { + int dx, dy; + + /* apply size hints */ + geo = client_geometry_hints(c, geo); + + /* get the nonmoveable corner back onto fixed_x,fixed_y */ + switch(corner) + { + default /* TopLeftCorner */: + dx = fixed_x - AREA_RIGHT(geo); + dy = fixed_y - AREA_BOTTOM(geo); + break; + case TopRightCorner: + dx = fixed_x - AREA_LEFT(geo); + dy = fixed_y - AREA_BOTTOM(geo); + break; + case BottomRightCorner: + dx = fixed_x - AREA_LEFT(geo); + dy = fixed_y - AREA_TOP(geo); + break; + case BottomLeftCorner: + dx = fixed_x - AREA_RIGHT(geo); + dy = fixed_y - AREA_TOP(geo); + break; + } + + geo.x += dx; + geo.y += dy; + } + /* resize the client */ - client_resize(c, geo, true); + client_resize(c, geo, false); /* draw the infobox */ if(sw)