X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fscreen.c;h=2d34f2632cd07060886f94b0dd0e6f16167999a5;hb=4c672be2e1f39e72eb7d7e99f129e61338f481b2;hp=5f0ef0e7f3faa6b10bfa87bf948b813c15fea9fc;hpb=3f2d342de80d819f5a40b6af1e4cc5478429e6be;p=chaz%2Fopenbox diff --git a/openbox/screen.c b/openbox/screen.c index 5f0ef0e7..2d34f263 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -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; @@ -887,7 +895,21 @@ void screen_show_desktop(gboolean show) break; } } else { - focus_fallback(TRUE); + /* use NULL for the "old" argument because the desktop was focused + and we don't want to fallback to the desktop by default */ + focus_hilite = focus_fallback_target(TRUE, NULL); + 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); + } } show = !!show; /* make it boolean */