about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--client.c6
-rw-r--r--view.c8
2 files changed, 8 insertions, 6 deletions
diff --git a/client.c b/client.c
index 49229a7..6524c06 100644
--- a/client.c
+++ b/client.c
@@ -414,14 +414,16 @@ togglemax(Arg *arg)
 void
 unmanage(Client *c)
 {
+	Client *nc;
+
 	XGrabServer(dpy);
 	XSetErrorHandler(xerrordummy);
 
 	detach(c);
 	detachstack(c);
 	if(sel == c) {
-		for(sel = stack; sel && !isvisible(sel); sel = sel->snext);
-		focus(sel);
+		for(nc = stack; nc && !isvisible(nc); nc = nc->snext);
+		focus(nc);
 	}
 
 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
diff --git a/view.c b/view.c
index 5cbab08..3e78661 100644
--- a/view.c
+++ b/view.c
@@ -77,8 +77,8 @@ dofloat(Arg *arg)
 			ban(c);
 	}
 	if(!sel || !isvisible(sel)) {
-		for(sel = stack; sel && !isvisible(sel); sel = sel->snext);
-		focus(sel);
+		for(c = stack; c && !isvisible(c); c = c->snext);
+		focus(c);
 	}
 	restack();
 }
@@ -141,8 +141,8 @@ dotile(Arg *arg)
 			ban(c);
 	}
 	if(!sel || !isvisible(sel)) {
-		for(sel = stack; sel && !isvisible(sel); sel = sel->snext);
-		focus(sel);
+		for(c = stack; c && !isvisible(c); c = c->snext);
+		focus(c);
 	}
 	restack();
 }