applied patch of Paul Liu to allow onthefly resizing due to xrandr changes f9e7a330
Anselm R. Garbe · 2007-05-07 13:12 3 file(s) · +25 −2
event.c +19 −0
208 208
}
209 209
210 210
static void
211 +
configurenotify(XEvent *e) {
212 +
	Client *c;
213 +
	XConfigureEvent *ev = &e->xconfigure;
214 +
	XWindowChanges wc;
215 +
216 +
	if (ev->window == root && (ev->width != sw || ev->height != sh)) {
217 +
		sw = ev->width;
218 +
		sh = ev->height;
219 +
		wah = sh - bh;
220 +
		waw = sw;
221 +
		XFreePixmap(dpy, dc.drawable);
222 +
		dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
223 +
		XResizeWindow(dpy, barwin, sw, bh);
224 +
		lt->arrange();
225 +
	}
226 +
}
227 +
228 +
static void
211 229
destroynotify(XEvent *e) {
212 230
	Client *c;
213 231
	XDestroyWindowEvent *ev = &e->xdestroywindow;
333 351
void (*handler[LASTEvent]) (XEvent *) = {
334 352
	[ButtonPress] = buttonpress,
335 353
	[ConfigureRequest] = configurerequest,
354 +
	[ConfigureNotify] = configurenotify,
336 355
	[DestroyNotify] = destroynotify,
337 356
	[EnterNotify] = enternotify,
338 357
	[LeaveNotify] = leavenotify,
layout.c +4 −1
46 46
				nw = tw - 2 * c->border;
47 47
				if(th > 2 * c->border) {
48 48
					ny += (i - nmaster) * th;
49 -
					nh = th - 2 * c->border;
49 +
					if(i == n - 1)
50 +
						nh = wah - ny - 2 * c->border;
51 +
					else
52 +
						nh = th - 2 * c->border;
50 53
				}
51 54
				else /* fallback if th <= 2 * c->border */
52 55
					nh = wah - 2 * c->border;
main.c +2 −1
163 163
	XFreeModifiermap(modmap);
164 164
	/* select for events */
165 165
	wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
166 -
		| EnterWindowMask | LeaveWindowMask;
166 +
		| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
167 167
	wa.cursor = cursor[CurNormal];
168 168
	XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
169 +
	XSelectInput(dpy, root, wa.event_mask);
169 170
	grabkeys();
170 171
	compileregs();
171 172
	for(ntags = 0; tags[ntags]; ntags++);