X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=event.c;h=e5ca1664854a8402c24820185dbf8dce386de1d8;hb=d4b7a9a3735deeab639f28b5bb2f568e0dc49616;hp=e452167460a59d7c1034bac80a705725e784b1d1;hpb=292ccc4c43d9529cb6db0973fcab6e24c73607a5;p=dwm.git diff --git a/event.c b/event.c index e452167..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) @@ -102,48 +105,37 @@ buttonpress(XEvent *e) XButtonPressedEvent *ev = &e->xbutton; if(barwin == ev->window) { - switch(ev->button) { - default: - x = 0; - for(a.i = 0; a.i < ntags; a.i++) { - x += textw(tags[a.i]); - if(ev->x < x) { - if(ev->button == Button3) - viewextend(&a); - else - view(&a); - return; - } + x = 0; + for(a.i = 0; a.i < ntags; a.i++) { + x += textw(tags[a.i]); + if(ev->x < x) { + if(ev->button == Button3) + toggleview(&a); + else + view(&a); + return; } - if(ev->button == Button1) - viewprev(&a); - else if(ev->button == Button3) - viewnext(&a); - break; - case Button4: - viewprev(&a); - break; - case Button5: - viewnext(&a); - break; } } 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; } }