]> Dogcows Code - chaz/openbox/blobdiff - openbox/screen.c
fix no more crashing in the client menu.
[chaz/openbox] / openbox / screen.c
index 5fc2bb9221390ecac63b6710d64a54dbfd578a67..d48d0dda2284fc6b1ec80cd1bfcf7a8de93ff3cb 100644 (file)
@@ -485,6 +485,27 @@ void screen_set_desktop(guint num, gboolean dofocus)
         }
     }
 
+    /* have to try focus here because when you leave an empty desktop
+       there is no focus out to watch for
+
+       do this before hiding the windows so if helper windows are coming
+       with us, they don't get hidden
+    */
+    if (dofocus && (c = focus_fallback_target(TRUE, focus_client))) {
+        /* only do the flicker reducing stuff ahead of time if we are going
+           to call xsetinputfocus on the window ourselves. otherwise there is
+           no guarantee the window will actually take focus.. */
+        if (c->can_focus) {
+            /* do this here so that if you switch desktops to a window with
+               helper windows then the helper windows won't flash */
+            client_bring_helper_windows(c);
+            /* reduce flicker by hiliting now rather than waiting for the
+               server FocusIn event */
+            frame_adjust_focus(c->frame, TRUE);
+        }
+        client_focus(c);
+    }
+
     /* hide windows from bottom to top */
     for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) {
         if (WINDOW_IS_CLIENT(it->data)) {
@@ -493,15 +514,6 @@ void screen_set_desktop(guint num, gboolean dofocus)
         }
     }
 
-    /* have to try focus here because when you leave an empty desktop
-       there is no focus out to watch for */
-    if (dofocus && (c = focus_fallback_target(TRUE, focus_client))) {
-        /* reduce flicker by hiliting now rather than waiting for the server
-           FocusIn event */
-        frame_adjust_focus(c->frame, TRUE);
-        client_focus(c);
-    }
-
     event_ignore_queued_enters();
 
     if (event_curtime != CurrentTime)
This page took 0.024645 seconds and 4 git commands to generate.