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,19 +2959,15 @@ 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) { /* if workspaces were swapped, then don't wait to set focus */
new_ws->focus_pending = get_region_focus(new_ws->r); if (old_ws->r && focus_mode != SWM_FOCUS_FOLLOW) {
if (new_ws->focus_pending) {
/* if workspaces were swapped, then don't wait to set focus */ focus_win(new_ws->focus_pending);
if (old_ws->r) { } else {
if (new_ws->focus_pending) { /* Empty region, focus on root. */
focus_win(new_ws->focus_pending); xcb_set_input_focus(conn, XCB_INPUT_FOCUS_PARENT,
} else { new_ws->r->s[new_ws->r->s->idx].root,
/* Empty region, focus on root. */ XCB_CURRENT_TIME);
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_PARENT,
new_ws->r->s[new_ws->r->s->idx].root,
XCB_CURRENT_TIME);
}
} }
} }
@ -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 */