reverting some border patches 2bb51b32
a@null · 2008-12-20 00:02 1 file(s) · +18 −7
dwm.c +18 −7
41 41
#endif
42 42
43 43
/* macros */
44 -
#define ADJUSTBORDER(C, BW)     if((C)->bw != (BW)) XSetWindowBorder(dpy, (C)->win, (BW));
45 44
#define BUTTONMASK              (ButtonPressMask|ButtonReleaseMask)
46 45
#define CLEANMASK(mask)         (mask & ~(numlockmask|LockMask))
47 46
#define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH))
129 128
} Rule;
130 129
131 130
/* function declarations */
131 +
static void adjustborder(Client *c, unsigned int bw);
132 132
static void applyrules(Client *c);
133 133
static void arrange(void);
134 134
static void attach(Client *c);
245 245
struct NumTags { char limitexceeded[sizeof(unsigned int) * 8 < LENGTH(tags) ? -1 : 1]; };
246 246
247 247
/* function implementations */
248 +
void
249 +
adjustborder(Client *c, unsigned int bw) {
250 +
	XWindowChanges wc;
251 +
252 +
	if(c->bw != bw) {
253 +
		c->bw = wc.border_width = bw;
254 +
		XConfigureWindow(dpy, c->win, CWBorderWidth, &wc);
255 +
	}
256 +
}
257 +
248 258
void
249 259
applyrules(Client *c) {
250 260
	unsigned int i;
930 940
931 941
	for(n = 0, c = nexttiled(clients); c && n < 2; c = nexttiled(c->next), n++);
932 942
	for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
933 -
		ADJUSTBORDER(c, (n == 1 ? 0 : borderpx))
943 +
		adjustborder(c, n == 1 ? 0 : borderpx);
934 944
		resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, resizehints);
935 945
	}
936 946
}
1137 1147
			handler[ev.type](&ev);
1138 1148
			break;
1139 1149
		case MotionNotify:
1140 -
			nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
1141 -
			nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
1150 +
			nw = MAX(ev.xmotion.x - ocx - 2*c->bw + 1, 1);
1151 +
			nh = MAX(ev.xmotion.y - ocy - 2*c->bw + 1, 1);
1152 +
1142 1153
			if(snap && nw >= wx && nw <= wx + ww
1143 1154
			        && nh >= wy && nh <= wy + wh) {
1144 1155
				if(!c->isfloating && lt[sellt]->arrange
1334 1345
	if(!c)
1335 1346
		return;
1336 1347
	if(ISVISIBLE(c)) { /* show clients top down */
1337 -
		ADJUSTBORDER(c, borderpx)
1348 +
		adjustborder(c, borderpx);
1338 1349
		XMoveWindow(dpy, c->win, c->x, c->y);
1339 1350
		if(!lt[sellt]->arrange || c->isfloating)
1340 1351
			resize(c, c->x, c->y, c->w, c->h, True);
1398 1409
	/* master */
1399 1410
	c = nexttiled(clients);
1400 1411
	mw = mfact * ww;
1401 -
	ADJUSTBORDER(c, (n == 1 ? 0 : borderpx))
1412 +
	adjustborder(c, n == 1 ? 0 : borderpx);
1402 1413
	resize(c, wx, wy, (n == 1 ? ww : mw) - 2 * c->bw, wh - 2 * c->bw, resizehints);
1403 1414
1404 1415
	if(--n == 0)
1413 1424
		h = wh;
1414 1425
1415 1426
	for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
1416 -
		ADJUSTBORDER(c, borderpx)
1427 +
		adjustborder(c, borderpx);
1417 1428
		resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n)
1418 1429
		       ? wy + wh - y - 2 * c->bw : h - 2 * c->bw), resizehints);
1419 1430
		if(h != wh)