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.
This commit is contained in:
Marco Peereboom 2009-10-23 20:33:53 +00:00
parent 05347c2d3e
commit 80e76b8191

View file

@ -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);
}