JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fix switchws after M-q by trying harder to find a focus window.
authorMarco Peereboom <marco@conformal.com>
Wed, 30 Sep 2009 16:45:24 +0000 (16:45 +0000)
committerMarco Peereboom <marco@conformal.com>
Wed, 30 Sep 2009 16:45:24 +0000 (16:45 +0000)
scrotwm.c

index 716759d..64a8b65 100644 (file)
--- a/scrotwm.c
+++ b/scrotwm.c
@@ -1203,22 +1203,19 @@ switchws(struct swm_region *r, union arg *args)
            "%d -> %d\n", r->s->idx, WIDTH(r), HEIGHT(r), X(r), Y(r),
            old_ws->idx, wsid);
 
-       /* get focus window */
-       if (new_ws->focus)
-               winfocus = new_ws->focus;
-       else if (new_ws->focus_prev)
-               winfocus = new_ws->focus_prev;
+       if (new_ws == old_ws)
+               return;
 
+       /* get focus window */
        if (new_ws->focus)
                winfocus = new_ws->focus;
        else if (new_ws->focus_prev)
                winfocus = new_ws->focus_prev;
-
-       if (new_ws == old_ws)
-               return;
+       else
+               winfocus = TAILQ_FIRST(&new_ws->winlist);
 
        other_r = new_ws->r;
-       if (!other_r) {
+       if (other_r == NULL) {
                /* if the other workspace is hidden, switch windows */
                /* map new window first to prevent ugly blinking */
                old_ws->r = NULL;