From: Marco Peereboom Date: Wed, 30 Sep 2009 16:45:24 +0000 (+0000) Subject: fix switchws after M-q by trying harder to find a focus window. X-Git-Url: https://jasonwoof.com/gitweb/?a=commitdiff_plain;h=4a52579466f80ce9cd0a81b9c351ce1470953a74;p=spectrwm.git fix switchws after M-q by trying harder to find a focus window. --- 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;