X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=event.c;h=e5ca1664854a8402c24820185dbf8dce386de1d8;hb=d4b7a9a3735deeab639f28b5bb2f568e0dc49616;hp=bc7d42c2a452097cf6e741c9e376374766af23d7;hpb=4cb78a170c6daa488a90dffb60224fcf2b76fbf0;p=dwm.git diff --git a/event.c b/event.c index bc7d42c..e5ca166 100644 --- a/event.c +++ b/event.c @@ -58,6 +58,7 @@ static void resizemouse(Client *c) { int ocx, ocy; + int nw, nh; Corner sticky; XEvent ev; @@ -76,8 +77,10 @@ resizemouse(Client *c) break; case MotionNotify: XSync(dpy, False); - c->w = abs(ocx - ev.xmotion.x); - c->h = abs(ocy - ev.xmotion.y); + if((nw = abs(ocx - ev.xmotion.x))) + c->w = abs(ocx - ev.xmotion.x); + if((nh = abs(ocy - ev.xmotion.y))) + c->h = abs(ocy - ev.xmotion.y); c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - c->w; c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - c->h; if(ocx <= ev.xmotion.x) @@ -115,21 +118,24 @@ buttonpress(XEvent *e) } } else if((c = getclient(ev->window))) { - higher(c); focus(c); switch(ev->button) { default: break; case Button1: - if(!c->ismax && (arrange == dofloat || c->isfloat)) + if(!c->ismax && (arrange == dofloat || c->isfloat)) { + restack(c); movemouse(c); + } break; case Button2: zoom(NULL); break; case Button3: - if(!c->ismax && (arrange == dofloat || c->isfloat)) + if(!c->ismax && (arrange == dofloat || c->isfloat)) { + restack(c); resizemouse(c); + } break; } }