client.c
changeset 151 e1859517e3a6
parent 148 5267e1204367
child 157 93012e947eae
equal deleted inserted replaced
150:a26b32ff8911 151:e1859517e3a6
   414 }
   414 }
   415 
   415 
   416 void
   416 void
   417 unmanage(Client *c)
   417 unmanage(Client *c)
   418 {
   418 {
   419 	Client **l;
       
   420 
       
   421 	XGrabServer(dpy);
   419 	XGrabServer(dpy);
   422 	XSetErrorHandler(xerrordummy);
   420 	XSetErrorHandler(xerrordummy);
   423 
   421 
   424 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
   422 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
   425 	XDestroyWindow(dpy, c->title);
   423 	XDestroyWindow(dpy, c->title);
   426 
   424 
   427 	for(l = &clients; *l && *l != c; l = &(*l)->next);
       
   428 	if(c->prev)
   425 	if(c->prev)
   429 		c->prev->next = c->next;
   426 		c->prev->next = c->next;
   430 	if(c->next)
   427 	if(c->next)
   431 		c->next->prev = c->prev;
   428 		c->next->prev = c->prev;
   432 	*l = c->next;
   429 	if(c == clients)
       
   430 		clients = c->next;
   433 	if(sel == c) {
   431 	if(sel == c) {
   434 		sel = getnext(c->next);
   432 		sel = getnext(c->next);
   435 		if(!sel)
   433 		if(!sel)
   436 			sel = getprev(c->prev);
   434 			sel = getprev(c->prev);
   437 		if(!sel)
   435 		if(!sel)
   448 }
   446 }
   449 
   447 
   450 void
   448 void
   451 zoom(Arg *arg)
   449 zoom(Arg *arg)
   452 {
   450 {
   453 	Client *c, **l;
   451 	Client *c;
   454 
   452 
   455 	if(!sel)
   453 	if(!sel)
   456 		return;
   454 		return;
   457 
   455 
   458 	if(sel == getnext(clients) && sel->next)  {
   456 	if(sel == getnext(clients) && sel->next)  {
   459 		if((c = getnext(sel->next)))
   457 		if((c = getnext(sel->next)))
   460 			sel = c;
   458 			sel = c;
   461 	}
   459 	}
   462 
   460 
   463 	/* pop */
   461 	/* pop */
   464 	for(l = &clients; *l && *l != sel; l = &(*l)->next);
       
   465 	if(sel->prev)
   462 	if(sel->prev)
   466 		sel->prev->next = sel->next;
   463 		sel->prev->next = sel->next;
   467 	if(sel->next)
   464 	if(sel->next)
   468 		sel->next->prev = sel->prev;
   465 		sel->next->prev = sel->prev;
   469 	*l = sel->next;
       
   470 
       
   471 	sel->prev = NULL;
   466 	sel->prev = NULL;
   472 	if(clients)
   467 	if(clients)
   473 		clients->prev = sel;
   468 		clients->prev = sel;
   474 	sel->next = clients;
   469 	sel->next = clients;
   475 	clients = sel;
   470 	clients = sel;