client.c
changeset 447 16c4e4c5fb15
parent 446 a2e587651c79
child 448 8089f22fdb46
equal deleted inserted replaced
446:a2e587651c79 447:16c4e4c5fb15
   412 }
   412 }
   413 
   413 
   414 void
   414 void
   415 unmanage(Client *c)
   415 unmanage(Client *c)
   416 {
   416 {
   417 	Client *tc, *fc;
       
   418 	Window trans;
       
   419 	XGrabServer(dpy);
   417 	XGrabServer(dpy);
   420 	XSetErrorHandler(xerrordummy);
   418 	XSetErrorHandler(xerrordummy);
   421 
   419 
   422 	detach(c);
   420 	detach(c);
   423 	if(sel == c) {
   421 	if(sel == c) {
   424 		XGetTransientForHint(dpy, c->win, &trans);
   422 		for(sel = stack; sel && !isvisible(sel); sel = sel->snext);
   425 		if(trans && (tc = getclient(trans)) && isvisible(tc))
   423 		focus(sel);
   426 			fc = tc;
       
   427 		else
       
   428 			fc = getnext(clients);
       
   429 		focus(fc);
       
   430 	}
   424 	}
   431 
   425 
   432 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
   426 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
   433 	XDestroyWindow(dpy, c->twin);
   427 	XDestroyWindow(dpy, c->twin);
   434 
   428