From 9c6cb3573ff2b461a7eb660259787a1af6273aaf Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Thu, 26 Mar 2009 03:18:04 +0100 Subject: [PATCH] Mouse: Simplify mouse_resize. --- src/mouse.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/mouse.c b/src/mouse.c index 2f792b3..c5c87a4 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -136,18 +136,11 @@ mouse_resize(Client *c) XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->geo.width + conf.client.borderheight, c->geo.height); - for(;;) + do { XMaskEvent(dpy, MouseMask | ExposureMask | SubstructureRedirectMask, &ev); - if(ev.type == ButtonRelease) - { - if(!c->tile) - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->geo.width + conf.client.borderheight, c->geo.height); - XUngrabPointer(dpy, CurrentTime); - return; - } - else if(ev.type == MotionNotify) + if(ev.type == MotionNotify) { geo.width = ((ev.xmotion.x - ocx < 1) ? 1 : ev.xmotion.x - ocx); geo.height = ((ev.xmotion.y - ocy < 1) ? 1 : ev.xmotion.y - ocy); @@ -160,6 +153,11 @@ mouse_resize(Client *c) expose(&ev.xexpose); } + while(ev.type != ButtonRelease); + + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->geo.width + conf.client.borderheight, c->geo.height); + XUngrabPointer(dpy, CurrentTime); + return; }