X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=event.c;h=0043ed29f78a7905e75e7e90b1da7a579003f441;hp=d0f446f7837466071f8e8b8432fee56ff60eb650;hb=ac24f132dba7e59d9d9ff98d984f5e0b0d20fd09;hpb=b6614261ea48c9711cefd79601e09fa764ee3075 diff --git a/event.c b/event.c index d0f446f..0043ed2 100644 --- a/event.c +++ b/event.c @@ -1,4 +1,4 @@ -/* (C)opyright MMVI Anselm R. Garbe +/* (C)opyright MMVI-MMVII Anselm R. Garbe * See LICENSE file for license details. */ #include "dwm.h" @@ -48,14 +48,14 @@ movemouse(Client *c) { XSync(dpy, False); c->x = ocx + (ev.xmotion.x - x1); c->y = ocy + (ev.xmotion.y - y1); - if(abs(c->x) < sx + SNAP) - c->x = sx; - if(abs(c->y) < sy + bh + SNAP) - c->y = sy + bh; - if(abs(c->x + c->w) > sx + sw - SNAP) - c->x = sw - c->w - 2 * BORDERPX; - if(abs(c->y + c->h) > sy + sh - SNAP) - c->y = sh - c->h - 2 * BORDERPX; + 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; } @@ -161,7 +161,6 @@ configurerequest(XEvent *e) { if((c = getclient(ev->window))) { c->ismax = False; - gravitate(c, True); if(ev->value_mask & CWX) c->x = ev->x; if(ev->value_mask & CWY) @@ -172,7 +171,6 @@ configurerequest(XEvent *e) { c->h = ev->height; if(ev->value_mask & CWBorderWidth) c->border = ev->border_width; - gravitate(c, False); wc.x = c->x; wc.y = c->y; wc.width = c->w; @@ -244,7 +242,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; @@ -256,7 +254,6 @@ keypress(XEvent *e) { { if(key[i].func) key[i].func(&key[i].arg); - return; } } } @@ -317,7 +314,7 @@ propertynotify(XEvent *e) { arrange(); break; case XA_WM_NORMAL_HINTS: - updatesize(c); + updatesizehints(c); break; } if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { @@ -355,7 +352,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;