X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=event.c;h=edfcc52036217967a256d720f786b54c19d15d4c;hb=61a1910f91fe6aba428193087d6c3ff21374ee5e;hp=7f040e2a5f4fe74462bbb8b1b20e3990e89bf7b2;hpb=5983c00b9508d48331b2c57f2c88ea09a8feb291;p=dwm.git diff --git a/event.c b/event.c index 7f040e2..edfcc52 100644 --- a/event.c +++ b/event.c @@ -18,6 +18,7 @@ typedef struct { KEYS #define CLEANMASK(mask) (mask & ~(numlockmask | LockMask)) +#define MOUSEMASK (BUTTONMASK | PointerMotionMask) static void movemouse(Client *c) { @@ -47,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; } @@ -135,7 +144,8 @@ buttonpress(XEvent *e) { } else if(ev->button == Button2) zoom(NULL); - else if(ev->button == Button3 && (arrange == dofloat || c->isfloat)) { + else if(ev->button == Button3 && (arrange == dofloat || c->isfloat) && + !c->isfixed) { restack(); resizemouse(c); } @@ -234,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; @@ -345,7 +355,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;