]> code.delx.au - spectrwm/commitdiff
Fix issue when switching to a workspace in fullscreen layout (max_stack).
authorReginald Kennedy <rk@rejii.com>
Fri, 24 Aug 2012 17:23:32 +0000 (01:23 +0800)
committerReginald Kennedy <rk@rejii.com>
Fri, 24 Aug 2012 17:30:44 +0000 (01:30 +0800)
spectrwm.c

index 950c708c242aacfba7a30d5f6be446504f31ef57..b2adf805c1246405a82fca9f6af48ad10fb0018b 100644 (file)
@@ -2948,6 +2948,10 @@ switchws(struct swm_region *r, union arg *args)
        this_r->ws = new_ws;
        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();
 
        /* unmap old windows */
@@ -2955,19 +2959,15 @@ switchws(struct swm_region *r, union arg *args)
                TAILQ_FOREACH(win, &old_ws->winlist, entry)
                        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 (old_ws->r) {
-                       if (new_ws->focus_pending) {
-                               focus_win(new_ws->focus_pending);
-                       } else {
-                               /* Empty region, focus on root. */
-                               xcb_set_input_focus(conn, XCB_INPUT_FOCUS_PARENT,
-                                   new_ws->r->s[new_ws->r->s->idx].root,
-                                   XCB_CURRENT_TIME);
-                       }
+       /* if workspaces were swapped, then don't wait to set focus */
+       if (old_ws->r && focus_mode != SWM_FOCUS_FOLLOW) {
+               if (new_ws->focus_pending) {
+                       focus_win(new_ws->focus_pending);
+               } else {
+                       /* Empty region, focus on root. */
+                       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);
                }
 
-               /* if we are being restarted go focus on first window */
-               if (winfocus) {
+               /* If just (re)started, set default focus if needed. */
+               if (winfocus && focus_mode == SWM_FOCUS_MANUAL) {
                        rr = winfocus->ws->r;
                        if (rr == NULL) {
                                /* not a visible window */