added isdestroyed flag to unmanage a3a859b4
Anselm R Garbe · 2009-09-08 13:13 1 file(s) · +16 −15
dwm.c +16 −15
218 218
static void toggletag(const Arg *arg);
219 219
static void toggleview(const Arg *arg);
220 220
static void unfocus(Client *c);
221 -
static void unmanage(Client *c);
221 +
static void unmanage(Client *c, Bool isdestroyed);
222 222
static void unmapnotify(XEvent *e);
223 223
static void updategeom(void);
224 224
static void updatebarpos(Monitor *m);
466 466
	selmon->lt[selmon->sellt] = &foo;
467 467
	for(m = mons; m; m = m->next)
468 468
		while(m->stack)
469 -
			unmanage(m->stack);
469 +
			unmanage(m->stack, False);
470 470
	if(dc.font.set)
471 471
		XFreeFontSet(dpy, dc.font.set);
472 472
	else
595 595
	XDestroyWindowEvent *ev = &e->xdestroywindow;
596 596
597 597
	if((c = wintoclient(ev->window)))
598 -
		unmanage(c);
598 +
		unmanage(c, True);
599 599
}
600 600
601 601
void
1626 1626
}
1627 1627
1628 1628
void
1629 -
unmanage(Client *c) {
1629 +
unmanage(Client *c, Bool isdestroyed) {
1630 1630
	XWindowChanges wc;
1631 1631
1632 -
	wc.border_width = c->oldbw;
1633 1632
	/* The server grab construct avoids race conditions. */
1634 -
	XGrabServer(dpy);
1635 -
	XSetErrorHandler(xerrordummy);
1636 -
	XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
1637 1633
	detach(c);
1638 1634
	detachstack(c);
1639 -
	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
1640 -
	setclientstate(c, WithdrawnState);
1635 +
	if(!isdestroyed) {
1636 +
		wc.border_width = c->oldbw;
1637 +
		XGrabServer(dpy);
1638 +
		XSetErrorHandler(xerrordummy);
1639 +
		XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
1640 +
		XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
1641 +
		setclientstate(c, WithdrawnState);
1642 +
		XSync(dpy, False);
1643 +
		XSetErrorHandler(xerror);
1644 +
		XUngrabServer(dpy);
1645 +
	}
1641 1646
	free(c);
1642 -
	XSync(dpy, False);
1643 -
	XSetErrorHandler(xerror);
1644 -
	XUngrabServer(dpy);
1645 1647
	focus(NULL);
1646 -
	arrange();
1647 1648
}
1648 1649
1649 1650
void
1652 1653
	XUnmapEvent *ev = &e->xunmap;
1653 1654
1654 1655
	if((c = wintoclient(ev->window)))
1655 -
		unmanage(c);
1656 +
		unmanage(c, False);
1656 1657
}
1657 1658
1658 1659
void