about summary refs log tree commit diff stats
path: root/view.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-01-05 21:55:43 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-01-05 21:55:43 +0100
commit7ac0de8350c51ef39e4dee5f60e1da641c4fbd5b (patch)
treeed1a4f31a0bb89c5a329092b525449cd49315023 /view.c
parent0b7c0f10eeee1c473b1adcee3a8b90db61b854e9 (diff)
downloaddwm-7ac0de8350c51ef39e4dee5f60e1da641c4fbd5b.tar.gz
removed swap(), implemented pop for everything
Diffstat (limited to 'view.c')
-rw-r--r--view.c69
1 files changed, 8 insertions, 61 deletions
diff --git a/view.c b/view.c
index b72e4d5..ffa22a1 100644
--- a/view.c
+++ b/view.c
@@ -11,44 +11,6 @@ nexttiled(Client *c) {
 	return c;
 }
 
-static Bool
-ismaster(Client *c) {
-	Client *cl;
-	unsigned int i;
-
-	for(cl = nexttiled(clients), i = 0; cl && cl != c; cl = nexttiled(cl->next), i++);
-	return i < nmaster;
-}
-
-static void
-pop(Client *c) {
-	detach(c);
-	if(clients)
-		clients->prev = c;
-	c->next = clients;
-	clients = c;
-}
-
-static void
-swap(Client *c1, Client *c2) {
-	Client tmp = *c1;
-	Client *c1p = c1->prev;
-	Client *c1n = c1->next;
-	Client *c1s = c1->snext;
-	Client *c2p = c2->prev;
-	Client *c2n = c2->next;
-	Client *c2s = c2->snext;
-
-	*c1 = *c2;
-	*c2 = tmp;
-	c1->prev = c1p;
-	c1->next = c1n;
-	c1->snext = c1s;
-	c2->prev = c2p;
-	c2->next = c2n;
-	c2->snext = c2s;
-}
-
 static void
 togglemax(Client *c) {
 	XEvent ev;
@@ -72,15 +34,6 @@ togglemax(Client *c) {
 	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
 }
 
-static Client *
-topofstack() {
-	Client *c;
-	unsigned int i;
-
-	for(c = nexttiled(clients), i = 0; c && i < nmaster; c = nexttiled(c->next), i++);
-	return (i < nmaster) ? NULL : c;
-}
-
 /* extern */
 
 void (*arrange)(void) = DEFMODE;
@@ -308,19 +261,13 @@ zoom(Arg *arg) {
 		n++;
 
 	c = sel;
-	if(arrange == dofloat)
-		return;
-	else if(n <= nmaster)
-		pop(c);
-	else if(ismaster(sel)) {
-		if(!(c = topofstack()))
-			return;
-		swap(c, sel);
-		c = sel;
+	if(arrange != dofloat) {
+		detach(c);
+		if(clients)
+			clients->prev = c;
+		c->next = clients;
+		clients = c;
+		focus(c);
+		arrange();
 	}
-	else
-		pop(c);
-
-	focus(c);
-	arrange();
 }