about summary refs log tree commit diff stats
path: root/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'event.c')
-rw-r--r--event.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/event.c b/event.c
index bf88819..d0f446f 100644
--- a/event.c
+++ b/event.c
@@ -48,6 +48,14 @@ movemouse(Client *c) {
 			XSync(dpy, False);
 			c->x = ocx + (ev.xmotion.x - x1);
 			c->y = ocy + (ev.xmotion.y - y1);
+			if(abs(c->x) < sx + SNAP)
+				c->x = sx;
+			if(abs(c->y) < sy + bh + SNAP)
+				c->y = sy + bh;
+			if(abs(c->x + c->w) > sx + sw - SNAP)
+				c->x = sw - c->w - 2 * BORDERPX;
+			if(abs(c->y + c->h) > sy + sh - SNAP)
+				c->y = sh - c->h - 2 * BORDERPX;
 			resize(c, False, TopLeft);
 			break;
 		}
135'>135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167