X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=event.c;h=1a8de56b208373c5e94b7100278f5583c51c0d39;hb=4d67199a4bb68e5377d2fece62a83fde66c92861;hp=53a110a6d48d49c884bb69c7c2ab555808039681;hpb=8278f0a6befccfb4eb156cb312c69e032158734a;p=dwm.git diff --git a/event.c b/event.c index 53a110a..1a8de56 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,27 +105,16 @@ buttonpress(XEvent *e) XButtonPressedEvent *ev = &e->xbutton; if(barwin == ev->window) { - switch(ev->button) { - case Button1: - x = 0; - for(a.i = 0; a.i < ntags; a.i++) { - x += textw(tags[a.i]); - if(ev->x < x) { + 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; - } + return; } - focusprev(NULL); - break; - case Button3: - focusnext(NULL); - break; - case Button4: - viewprev(&a); - break; - case Button5: - viewnext(&a); - break; } } else if((c = getclient(ev->window))) {