summaryrefslogtreecommitdiff
path: root/mcwm.c
diff options
context:
space:
mode:
authorMC <mc@hack.org>2010-07-09 11:16:43 +0200
committerMC <mc@hack.org>2010-07-09 11:16:43 +0200
commit16dcfef443d6f0a6f0e6829f077064ae2db75351 (patch)
tree32aa30959b53aa6899b4ab367fb0b0022de1db76 /mcwm.c
parent2cfba8ebcad3b8ef4f226de900b45203d042bea1 (diff)
downloadmcwm-16dcfef443d6f0a6f0e6829f077064ae2db75351.zip
Fixed bug when we could resize a bit outside the root window.
Diffstat (limited to 'mcwm.c')
-rw-r--r--mcwm.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/mcwm.c b/mcwm.c
index f9b08df..ad6110a 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -1369,8 +1369,8 @@ void mouseresize(xcb_drawable_t win, int rel_x, int rel_y)
{
xcb_get_geometry_reply_t *geom;
xcb_size_hints_t hints;
- uint32_t width;
- uint32_t height;
+ int32_t width;
+ int32_t height;
uint32_t width_inc = 1;
uint32_t height_inc = 1;
@@ -1417,6 +1417,8 @@ void mouseresize(xcb_drawable_t win, int rel_x, int rel_y)
* width and height in reporting window sizes to users. If a
* base size is not provided, the minimum size is to be used in
* its place and vice versa.
+ *
+ * FIXME: This should be in the struct client.
*/
if (!xcb_get_wm_normal_hints_reply(
conn, xcb_get_wm_normal_hints_unchecked(conn, win), &hints, NULL))
@@ -1450,14 +1452,14 @@ void mouseresize(xcb_drawable_t win, int rel_x, int rel_y)
}
}
- if (width > screen->width_in_pixels)
+ if (geom->x + width > screen->width_in_pixels - BORDERWIDTH * 2)
{
- width = (screen->width_in_pixels - geom->x) / width_inc;
+ width = screen->width_in_pixels - (geom->x + BORDERWIDTH * 2);
}
- if (height > screen->height_in_pixels)
+ if (geom->y + height > screen->height_in_pixels - BORDERWIDTH * 2)
{
- height = (screen->height_in_pixels - geom->y) / height_inc;
+ height = screen->height_in_pixels - (geom->y + BORDERWIDTH * 2);
}
PDEBUG("Resizing to %dx%d (%dx%d)\n", width, height,