X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fscreen.c;h=c0569c29406eadd79027b0d7631b8fa4346e4a62;hb=ea088eb88d7c29558fa59563a934545bc122d5eb;hp=298a0b22b4c4f13961e43644a88a9f90fd72a2fd;hpb=33cc5724028121753bfc6e4fc51f3027864f9678;p=chaz%2Fopenbox diff --git a/openbox/screen.c b/openbox/screen.c index 298a0b22..c0569c29 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -166,7 +166,7 @@ gboolean screen_annex() CopyFromParent, InputOutput, CopyFromParent, CWOverrideRedirect, &attrib); - XMapRaised(ob_display, screen_support_win); + XMapWindow(ob_display, screen_support_win); if (!replace_wm()) { XDestroyWindow(ob_display, screen_support_win); @@ -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; @@ -435,11 +444,11 @@ void screen_set_desktop(guint num) /* show windows before hiding the rest to lessen the enter/leave events */ - /* show windows from top to bottom */ + /* show/hide windows from top to bottom */ for (it = stacking_list; it; it = g_list_next(it)) { if (WINDOW_IS_CLIENT(it->data)) { ObClient *c = it->data; - client_showhide(c); + client_show(c); } } @@ -447,24 +456,20 @@ void screen_set_desktop(guint num) for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) { if (WINDOW_IS_CLIENT(it->data)) { ObClient *c = it->data; - client_showhide(c); + client_hide(c); } } - event_ignore_queued_enters(); - - 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, sometmies the window you click on - another desktop ends up losing focus cuz of the focus change here. - */ - /*if (!focus_client)*/ - client_focus(focus_hilite); + /* have to try focus here because when you leave an empty desktop + there is no focus out to watch for */ + if ((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(); } static void get_row_col(guint d, guint *r, guint *c) @@ -886,7 +891,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 */