aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2012-01-14 17:11:08 +0200
committerIvan Kanakarakis <ivan.kanak@gmail.com>2012-01-14 17:11:08 +0200
commit4723e88826622b637a3d3b153718fbbfebdc810a (patch)
tree0a4a313f78899e3c4e9fe623b0227378952dcc48
parent21a66e96c3fcffda3c8d44d6489bef80cae7484c (diff)
on resize check for minimum window size
-rw-r--r--monsterwm.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/monsterwm.c b/monsterwm.c
index ab73507..6b0d49e 100644
--- a/monsterwm.c
+++ b/monsterwm.c
@@ -524,7 +524,7 @@ void mousemotion(const Arg *arg) {
if (XGrabPointer(dis, root, False, BUTTONMASK|PointerMotionMask, GrabModeAsync,
GrabModeAsync, None, None, CurrentTime) != GrabSuccess) return;
- int x, y, z; unsigned int v; Window w;
+ int x, y, z, xw, yh; unsigned int v; Window w;
XQueryPointer(dis, root, &w, &w, &x, &y, &z, &z, &v);
XEvent ev;
@@ -536,8 +536,10 @@ void mousemotion(const Arg *arg) {
events[ev.type](&ev);
break;
case MotionNotify:
- if (arg->i == MOVE) XMoveWindow(dis, current->win, wa.x + ev.xmotion.x - x, wa.y + ev.xmotion.y - y);
- else XResizeWindow(dis, current->win, wa.width + ev.xmotion.x - x, wa.height + ev.xmotion.y - y);
+ xw = (arg->i == MOVE ? wa.x : wa.width) + ev.xmotion.x - x;
+ yh = (arg->i == MOVE ? wa.y : wa.height) + ev.xmotion.y - y;
+ if (arg->i == RESIZE) XResizeWindow(dis, current->win, xw>MINWSZ?xw:wa.width, yh>MINWSZ?yh:wa.height);
+ else if (arg->i == MOVE) XMoveWindow(dis, current->win, xw, yh);
break;
}
current->isfloating = True;