added isdestroyed flag to unmanage

This commit is contained in:
Anselm R Garbe 2009-09-08 13:13:03 +01:00
parent 9c066c24b3
commit a3a859b4e9

21
dwm.c
View file

@ -218,7 +218,7 @@ static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg); static void toggleview(const Arg *arg);
static void unfocus(Client *c); static void unfocus(Client *c);
static void unmanage(Client *c); static void unmanage(Client *c, Bool isdestroyed);
static void unmapnotify(XEvent *e); static void unmapnotify(XEvent *e);
static void updategeom(void); static void updategeom(void);
static void updatebarpos(Monitor *m); static void updatebarpos(Monitor *m);
@ -466,7 +466,7 @@ cleanup(void) {
selmon->lt[selmon->sellt] = &foo; selmon->lt[selmon->sellt] = &foo;
for(m = mons; m; m = m->next) for(m = mons; m; m = m->next)
while(m->stack) while(m->stack)
unmanage(m->stack); unmanage(m->stack, False);
if(dc.font.set) if(dc.font.set)
XFreeFontSet(dpy, dc.font.set); XFreeFontSet(dpy, dc.font.set);
else else
@ -595,7 +595,7 @@ destroynotify(XEvent *e) {
XDestroyWindowEvent *ev = &e->xdestroywindow; XDestroyWindowEvent *ev = &e->xdestroywindow;
if((c = wintoclient(ev->window))) if((c = wintoclient(ev->window)))
unmanage(c); unmanage(c, True);
} }
void void
@ -1626,24 +1626,25 @@ unfocus(Client *c) {
} }
void void
unmanage(Client *c) { unmanage(Client *c, Bool isdestroyed) {
XWindowChanges wc; XWindowChanges wc;
wc.border_width = c->oldbw;
/* The server grab construct avoids race conditions. */ /* The server grab construct avoids race conditions. */
detach(c);
detachstack(c);
if(!isdestroyed) {
wc.border_width = c->oldbw;
XGrabServer(dpy); XGrabServer(dpy);
XSetErrorHandler(xerrordummy); XSetErrorHandler(xerrordummy);
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */ XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
detach(c);
detachstack(c);
XUngrabButton(dpy, AnyButton, AnyModifier, c->win); XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
setclientstate(c, WithdrawnState); setclientstate(c, WithdrawnState);
free(c);
XSync(dpy, False); XSync(dpy, False);
XSetErrorHandler(xerror); XSetErrorHandler(xerror);
XUngrabServer(dpy); XUngrabServer(dpy);
}
free(c);
focus(NULL); focus(NULL);
arrange();
} }
void void
@ -1652,7 +1653,7 @@ unmapnotify(XEvent *e) {
XUnmapEvent *ev = &e->xunmap; XUnmapEvent *ev = &e->xunmap;
if((c = wintoclient(ev->window))) if((c = wintoclient(ev->window)))
unmanage(c); unmanage(c, False);
} }
void void