several changes towards 5.3, XINERAMA is disabled by default, introduced usegrab Bool for grabbing the server during mouse-based resizals/movements (disabled by default), continued debugging tile() with resizehints == True and a lot of terminals supporting resizehints, still no optimal solution, I need to think about it, considering recursive algorithm for the space optimization ea8a4ca4
Anselm R Garbe · 2008-10-19 12:59 3 file(s) · +26 −12
config.def.h +2 −0
13 13
static Bool showbar                 = True;     /* False means no bar */
14 14
static Bool topbar                  = True;     /* False means bottom bar */
15 15
static Bool readin                  = True;     /* False means do not read stdin */
16 +
static Bool usegrab                 = False;    /* True means grabbing the X server
17 +
                                                   during mouse-based resizals */
16 18
17 19
/* tagging */
18 20
static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
config.mk +4 −4
1 1
# dwm version
2 -
VERSION = 5.2
2 +
VERSION = 5.3
3 3
4 4
# Customize below to fit your system
5 5
10 10
X11INC = /usr/X11R6/include
11 11
X11LIB = /usr/X11R6/lib
12 12
13 -
# Xinerama, comment if you don't want it
14 -
XINERAMALIBS = -L${X11LIB} -lXinerama
15 -
XINERAMAFLAGS = -DXINERAMA
13 +
# Xinerama, un-comment if you want it
14 +
#XINERAMALIBS = -L${X11LIB} -lXinerama
15 +
#XINERAMAFLAGS = -DXINERAMA
16 16
17 17
# includes and libs
18 18
INCS = -I. -I/usr/include -I${X11INC}
dwm.c +20 −8
53 53
#define MIN(a, b)               ((a) < (b) ? (a) : (b))
54 54
#define MAXTAGLEN               16
55 55
#define MOUSEMASK               (BUTTONMASK|PointerMotionMask)
56 -
#define WIDTH(x)                ((x)->w + 2*(x)->bw)
57 -
#define HEIGHT(x)               ((x)->h + 2*(x)->bw)
56 +
#define WIDTH(x)                ((x)->w + 2 * (x)->bw)
57 +
#define HEIGHT(x)               ((x)->h + 2 * (x)->bw)
58 58
#define TAGMASK                 ((int)((1LL << LENGTH(tags)) - 1))
59 59
#define TEXTW(x)                (textnw(x, strlen(x)) + dc.font.height)
60 60
932 932
	Client *c;
933 933
934 934
	for(c = nexttiled(clients); c; c = nexttiled(c->next))
935 -
		resize(c, wx, wy, ww - 2*c->bw, wh - 2*c->bw, resizehints);
935 +
		resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, resizehints);
936 936
}
937 937
938 938
void
952 952
	None, cursor[CurMove], CurrentTime) != GrabSuccess)
953 953
		return;
954 954
	XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui);
955 +
	if(usegrab)
956 +
		XGrabServer(dpy);
955 957
	do {
956 958
		XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
957 959
		switch (ev.type) {
961 963
			handler[ev.type](&ev);
962 964
			break;
963 965
		case MotionNotify:
964 -
			XSync(dpy, False);
965 966
			nx = ocx + (ev.xmotion.x - x);
966 967
			ny = ocy + (ev.xmotion.y - y);
967 968
			if(snap && nx >= wx && nx <= wx + ww
983 984
		}
984 985
	}
985 986
	while(ev.type != ButtonRelease);
987 +
	if(usegrab)
988 +
		XUngrabServer(dpy);
986 989
	XUngrabPointer(dpy, CurrentTime);
987 990
}
988 991
1121 1124
	None, cursor[CurResize], CurrentTime) != GrabSuccess)
1122 1125
		return;
1123 1126
	XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
1127 +
	if(usegrab)
1128 +
		XGrabServer(dpy);
1124 1129
	do {
1125 1130
		XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
1126 1131
		switch(ev.type) {
1130 1135
			handler[ev.type](&ev);
1131 1136
			break;
1132 1137
		case MotionNotify:
1133 -
			XSync(dpy, False);
1134 1138
			nw = MAX(ev.xmotion.x - ocx - 2*c->bw + 1, 1);
1135 1139
			nh = MAX(ev.xmotion.y - ocy - 2*c->bw + 1, 1);
1136 1140
1146 1150
		}
1147 1151
	}
1148 1152
	while(ev.type != ButtonRelease);
1153 +
	if(usegrab)
1154 +
		XUngrabServer(dpy);
1149 1155
	XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
1150 1156
	XUngrabPointer(dpy, CurrentTime);
1151 1157
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
1435 1441
	/* master */
1436 1442
	c = nexttiled(clients);
1437 1443
	mw = mfact * ww;
1438 -
	resize(c, wx, wy, (n == 1 ? ww : mw) - 2*c->bw, wh - 2*c->bw, resizehints);
1444 +
	resize(c, wx, wy, (n == 1 ? ww : mw) - 2 * c->bw, wh - 2 * c->bw, resizehints);
1439 1445
1440 1446
	if(--n == 0)
1441 1447
		return;
1449 1455
		h = wh;
1450 1456
1451 1457
	for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
1452 -
		resize(c, x, y, w - 2*c->bw, /* remainder */ ((i + 1 == n)
1453 -
		       ? wy + wh - y : h) - 2*c->bw, resizehints);
1458 +
		if(i + 1 == n) { /* remainder */
1459 +
			if(wy + wh - y < bh)
1460 +
				resize(c, x, y, w - 2 * c->bw, wy + wh - y - 2 * c->bw, False);
1461 +
			else
1462 +
				resize(c, x, y, w - 2 * c->bw, wy + wh - y - 2 * c->bw, resizehints);
1463 +
		}
1464 +
		else
1465 +
			resize(c, x, y, w - 2 * c->bw, h - 2 * c->bw, resizehints);
1454 1466
		if(h != wh)
1455 1467
			y = c->y + HEIGHT(c);
1456 1468
	}