X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=event.c;h=e3bdea42fa30f6a9b564d3ac08dc43ea288adf46;hb=0c5f47e720d2c1fa5b3f2672ec03d0f267e62c90;hp=0e98f0fbe42420aa6c208f1f08a288466314b051;hpb=0f395c1b115280a0976a85940c714152d8a58dac;p=dwm.git diff --git a/event.c b/event.c index 0e98f0f..e3bdea4 100644 --- a/event.c +++ b/event.c @@ -48,6 +48,14 @@ movemouse(Client *c) { XSync(dpy, False); c->x = ocx + (ev.xmotion.x - x1); c->y = ocy + (ev.xmotion.y - y1); + if(abs(sx + c->x) < SNAP) + c->x = sx; + else if(abs((sx + sw) - (c->x + c->w)) < SNAP) + c->x = sw - c->w - 2 * BORDERPX; + if(abs((sy + bh) - c->y) < SNAP) + c->y = sy + bh; + else if(abs((sy + sh) - (c->y + c->h)) < SNAP) + c->y = sh - c->h - 2 * BORDERPX; resize(c, False, TopLeft); break; } @@ -136,7 +144,8 @@ buttonpress(XEvent *e) { } else if(ev->button == Button2) zoom(NULL); - else if(ev->button == Button3 && (arrange == dofloat || c->isfloat) && !c->isfixed) { + else if(ev->button == Button3 && (arrange == dofloat || c->isfloat) && + !c->isfixed) { restack(); resizemouse(c); }