From 4a52579466f80ce9cd0a81b9c351ce1470953a74 Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Wed, 30 Sep 2009 16:45:24 +0000 Subject: [PATCH] fix switchws after M-q by trying harder to find a focus window. --- scrotwm.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/scrotwm.c b/scrotwm.c index 716759d..64a8b65 100644 --- 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; -- 1.7.10.4