aewl

diff view.c @ 660:4c6d27f03773

removed swap(), implemented pop for everything
author Anselm R. Garbe <arg@suckless.org>
date Fri, 05 Jan 2007 21:55:43 +0100
parents 498b86c72a40
children 4b8096176bbe
line diff
     1.1 --- a/view.c	Fri Jan 05 21:52:17 2007 +0100
     1.2 +++ b/view.c	Fri Jan 05 21:55:43 2007 +0100
     1.3 @@ -11,44 +11,6 @@
     1.4  	return c;
     1.5  }
     1.6  
     1.7 -static Bool
     1.8 -ismaster(Client *c) {
     1.9 -	Client *cl;
    1.10 -	unsigned int i;
    1.11 -
    1.12 -	for(cl = nexttiled(clients), i = 0; cl && cl != c; cl = nexttiled(cl->next), i++);
    1.13 -	return i < nmaster;
    1.14 -}
    1.15 -
    1.16 -static void
    1.17 -pop(Client *c) {
    1.18 -	detach(c);
    1.19 -	if(clients)
    1.20 -		clients->prev = c;
    1.21 -	c->next = clients;
    1.22 -	clients = c;
    1.23 -}
    1.24 -
    1.25 -static void
    1.26 -swap(Client *c1, Client *c2) {
    1.27 -	Client tmp = *c1;
    1.28 -	Client *c1p = c1->prev;
    1.29 -	Client *c1n = c1->next;
    1.30 -	Client *c1s = c1->snext;
    1.31 -	Client *c2p = c2->prev;
    1.32 -	Client *c2n = c2->next;
    1.33 -	Client *c2s = c2->snext;
    1.34 -
    1.35 -	*c1 = *c2;
    1.36 -	*c2 = tmp;
    1.37 -	c1->prev = c1p;
    1.38 -	c1->next = c1n;
    1.39 -	c1->snext = c1s;
    1.40 -	c2->prev = c2p;
    1.41 -	c2->next = c2n;
    1.42 -	c2->snext = c2s;
    1.43 -}
    1.44 -
    1.45  static void
    1.46  togglemax(Client *c) {
    1.47  	XEvent ev;
    1.48 @@ -72,15 +34,6 @@
    1.49  	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
    1.50  }
    1.51  
    1.52 -static Client *
    1.53 -topofstack() {
    1.54 -	Client *c;
    1.55 -	unsigned int i;
    1.56 -
    1.57 -	for(c = nexttiled(clients), i = 0; c && i < nmaster; c = nexttiled(c->next), i++);
    1.58 -	return (i < nmaster) ? NULL : c;
    1.59 -}
    1.60 -
    1.61  /* extern */
    1.62  
    1.63  void (*arrange)(void) = DEFMODE;
    1.64 @@ -308,19 +261,13 @@
    1.65  		n++;
    1.66  
    1.67  	c = sel;
    1.68 -	if(arrange == dofloat)
    1.69 -		return;
    1.70 -	else if(n <= nmaster)
    1.71 -		pop(c);
    1.72 -	else if(ismaster(sel)) {
    1.73 -		if(!(c = topofstack()))
    1.74 -			return;
    1.75 -		swap(c, sel);
    1.76 -		c = sel;
    1.77 +	if(arrange != dofloat) {
    1.78 +		detach(c);
    1.79 +		if(clients)
    1.80 +			clients->prev = c;
    1.81 +		c->next = clients;
    1.82 +		clients = c;
    1.83 +		focus(c);
    1.84 +		arrange();
    1.85  	}
    1.86 -	else
    1.87 -		pop(c);
    1.88 -
    1.89 -	focus(c);
    1.90 -	arrange();
    1.91  }