]> Dogcows Code - chaz/openbox/blobdiff - openbox/screen.c
a) remove focus_hilite, it is not needed and complicated things
[chaz/openbox] / openbox / screen.c
index 5f0ef0e7f3faa6b10bfa87bf948b813c15fea9fc..a54b2b564074f771ba2bacae86b61045413ac5fe 100644 (file)
@@ -300,8 +300,16 @@ void screen_startup(gboolean reconfig)
         screen_num_desktops = 0;
     screen_set_num_desktops(config_desktops_num);
     if (!reconfig) {
-        screen_set_desktop(MIN(config_screen_firstdesk, screen_num_desktops)
-                           - 1);
+        guint32 d;
+        /* start on the current desktop when a wm was already running */
+        if (PROP_GET32(RootWindow(ob_display, ob_screen),
+                       net_current_desktop, cardinal, &d) &&
+            d < screen_num_desktops)
+        {
+            screen_set_desktop(d);
+        } else
+            screen_set_desktop(MIN(config_screen_firstdesk,
+                                   screen_num_desktops) - 1);
 
         /* don't start in showing-desktop mode */
         screen_showing_desktop = FALSE;
@@ -414,6 +422,7 @@ void screen_set_num_desktops(guint num)
 
 void screen_set_desktop(guint num)
 {
+    ObClient *c;
     GList *it;
     guint old;
      
@@ -451,21 +460,12 @@ void screen_set_desktop(guint num)
         }
     }
 
-    event_ignore_queued_enters();
+    /* reduce flicker by hiliting now rather than waiting for the server
+       FocusIn event */
+    if ((c = focus_fallback_target(TRUE, focus_client)))
+        frame_adjust_focus(c->frame, TRUE);
 
-    focus_hilite = focus_fallback_target(TRUE, focus_client);
-    if (focus_hilite) {
-        frame_adjust_focus(focus_hilite->frame, TRUE);
-
-        /*!
-          When this focus_client check is not used, you can end up with
-          races, as demonstrated with gnome-panel, sometimes the window
-          you click on another desktop ends up losing focus cuz of the
-          focus change here.
-        */
-        /*if (!focus_client)*/
-        client_focus(focus_hilite);
-    }
+    event_ignore_queued_enters();
 }
 
 static void get_row_col(guint d, guint *r, guint *c)
@@ -887,7 +887,12 @@ void screen_show_desktop(gboolean show)
                 break;
         }
     } else {
-        focus_fallback(TRUE);
+        ObClient *c;
+
+        /* use NULL for the "old" argument because the desktop was focused
+           and we don't want to fallback to the desktop by default */
+        if ((c = focus_fallback_target(TRUE, NULL)))
+            client_focus(c);
     }
 
     show = !!show; /* make it boolean */
This page took 0.02796 seconds and 4 git commands to generate.