added screen-border snapping in floating mode, feels quite well b6614261
arg@mig29 · 2006-10-30 11:58 3 file(s) · +10 −0
config.arg.h +1 −0
19 19
20 20
#define MASTER			600 /* per thousand */
21 21
#define MODKEY			Mod1Mask
22 +
#define SNAP			20 /* pixel */
22 23
23 24
#define KEYS \
24 25
static Key key[] = { \
config.default.h +1 −0
19 19
20 20
#define MASTER			600 /* per thousand */
21 21
#define MODKEY			Mod1Mask
22 +
#define SNAP			20 /* pixel */
22 23
23 24
#define KEYS \
24 25
static Key key[] = { \
event.c +8 −0
48 48
			XSync(dpy, False);
49 49
			c->x = ocx + (ev.xmotion.x - x1);
50 50
			c->y = ocy + (ev.xmotion.y - y1);
51 +
			if(abs(c->x) < sx + SNAP)
52 +
				c->x = sx;
53 +
			if(abs(c->y) < sy + bh + SNAP)
54 +
				c->y = sy + bh;
55 +
			if(abs(c->x + c->w) > sx + sw - SNAP)
56 +
				c->x = sw - c->w - 2 * BORDERPX;
57 +
			if(abs(c->y + c->h) > sy + sh - SNAP)
58 +
				c->y = sh - c->h - 2 * BORDERPX;
51 59
			resize(c, False, TopLeft);
52 60
			break;
53 61
		}