From: Marco Peereboom Date: Fri, 23 Oct 2009 20:33:53 +0000 (+0000) Subject: Add simple heuristic to max_stack focus to deal with new event reality. X-Git-Url: https://jasonwoof.com/gitweb/?a=commitdiff_plain;h=80e76b8191fc2de100f1c7741c5730bb7fe47379;p=spectrwm.git Add simple heuristic to max_stack focus to deal with new event reality. This mostly uses the same logic as a normal stack but it detects if the previous window got unmapped and goes back to the parent. The rest is the same code as stacked focusing. --- diff --git a/scrotwm.c b/scrotwm.c index 07a4417..0137fe7 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -1678,13 +1678,12 @@ focus_prev(struct ws_win *win) } /* if in max_stack try harder */ - /* XXX needs more love */ if (ws->cur_layout->flags & SWM_L_FOCUSPREV) { - if (cur_focus != ws->focus_prev) - winfocus = ws->focus_prev; - else if (cur_focus != ws->focus) - winfocus = ws->focus; - goto done; + /* window got unmapped go to parent which is now cur_focus */ + if (ws->focus_prev == win) + winfocus = cur_focus; + if (winfocus) + goto focusanyway; } if (cur_focus == win) @@ -1696,6 +1695,7 @@ focus_prev(struct ws_win *win) done: if (winfocus == winlostfocus || winfocus == NULL) return; +focusanyway: focus_magic(winfocus, SWM_F_GENERIC); }