X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=event.c;h=4e115523b6b7d38fce0a39faad8231ebc136fe9a;hb=99964398e7e7e8b23952f7f1997bf78d1afa8e7b;hp=0e98f0fbe42420aa6c208f1f08a288466314b051;hpb=0f395c1b115280a0976a85940c714152d8a58dac;p=dwm.git diff --git a/event.c b/event.c index 0e98f0f..4e11552 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(wax + c->x) < SNAP) + c->x = wax; + else if(abs((wax + waw) - (c->x + c->w)) < SNAP) + c->x = wax + waw - c->w - 2 * BORDERPX; + if(abs(way - c->y) < SNAP) + c->y = way; + else if(abs((way + wah) - (c->y + c->h)) < SNAP) + c->y = way + wah - 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); } @@ -235,7 +244,7 @@ expose(XEvent *e) { static void keypress(XEvent *e) { - static unsigned int len = sizeof(key) / sizeof(key[0]); + static unsigned int len = sizeof key / sizeof key[0]; unsigned int i; KeySym keysym; XKeyEvent *ev = &e->xkey; @@ -247,7 +256,6 @@ keypress(XEvent *e) { { if(key[i].func) key[i].func(&key[i].arg); - return; } } } @@ -346,7 +354,7 @@ void (*handler[LASTEvent]) (XEvent *) = { void grabkeys(void) { - static unsigned int len = sizeof(key) / sizeof(key[0]); + static unsigned int len = sizeof key / sizeof key[0]; unsigned int i; KeyCode code;