JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
applied Christof Musik's multihead patch for a pathologic cornercase
[dwm.git] / view.c
diff --git a/view.c b/view.c
index 9ee4c78..3e78661 100644 (file)
--- a/view.c
+++ b/view.c
@@ -76,8 +76,10 @@ dofloat(Arg *arg)
                else
                        ban(c);
        }
-       if(!sel || !isvisible(sel))
-               focus(getnext(clients));
+       if(!sel || !isvisible(sel)) {
+               for(c = stack; c && !isvisible(c); c = c->snext);
+               focus(c);
+       }
        restack();
 }
 
@@ -138,8 +140,10 @@ dotile(Arg *arg)
                else
                        ban(c);
        }
-       if(!sel || !isvisible(sel))
-               focus(getnext(clients));
+       if(!sel || !isvisible(sel)) {
+               for(c = stack; c && !isvisible(c); c = c->snext);
+               focus(c);
+       }
        restack();
 }
 
@@ -227,7 +231,7 @@ restack()
                XRaiseWindow(dpy, sel->win);
                XRaiseWindow(dpy, sel->twin);
        }
-       if(arrange != dofloat) 
+       if(arrange != dofloat)
                for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
                        XLowerWindow(dpy, c->twin);
                        XLowerWindow(dpy, c->win);