Fix issue when switching to a workspace in fullscreen layout (max_stack).

This commit is contained in:
Reginald Kennedy 2012-08-25 01:23:32 +08:00
parent 8b3d816a64
commit a23aaa1549

View file

@ -2948,6 +2948,10 @@ switchws(struct swm_region *r, union arg *args)
this_r->ws = new_ws; this_r->ws = new_ws;
new_ws->r = this_r; new_ws->r = this_r;
/* Set focus_pending before stacking. */
if (focus_mode != SWM_FOCUS_FOLLOW)
new_ws->focus_pending = get_region_focus(new_ws->r);
stack(); stack();
/* unmap old windows */ /* unmap old windows */
@ -2955,11 +2959,8 @@ switchws(struct swm_region *r, union arg *args)
TAILQ_FOREACH(win, &old_ws->winlist, entry) TAILQ_FOREACH(win, &old_ws->winlist, entry)
unmap_window(win); unmap_window(win);
if (focus_mode != SWM_FOCUS_FOLLOW) {
new_ws->focus_pending = get_region_focus(new_ws->r);
/* if workspaces were swapped, then don't wait to set focus */ /* if workspaces were swapped, then don't wait to set focus */
if (old_ws->r) { if (old_ws->r && focus_mode != SWM_FOCUS_FOLLOW) {
if (new_ws->focus_pending) { if (new_ws->focus_pending) {
focus_win(new_ws->focus_pending); focus_win(new_ws->focus_pending);
} else { } else {
@ -2969,7 +2970,6 @@ switchws(struct swm_region *r, union arg *args)
XCB_CURRENT_TIME); XCB_CURRENT_TIME);
} }
} }
}
/* Clear bar if new ws is empty. */ /* Clear bar if new ws is empty. */
if (new_ws->focus_pending == NULL) if (new_ws->focus_pending == NULL)
@ -8707,8 +8707,8 @@ noconfig:
free(evt); free(evt);
} }
/* if we are being restarted go focus on first window */ /* If just (re)started, set default focus if needed. */
if (winfocus) { if (winfocus && focus_mode == SWM_FOCUS_MANUAL) {
rr = winfocus->ws->r; rr = winfocus->ws->r;
if (rr == NULL) { if (rr == NULL) {
/* not a visible window */ /* not a visible window */