X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fscreen.c;h=f7c71abe07d0445c166595ea5b6889b9f6f93ff2;hb=aa6bedd78bcebc33ac15c79ccebd8b4f14aefd02;hp=8a9475adf57d87592bcf029076d788f090688c29;hpb=4e8eff328cf9f99f833ce01997621d3817074ab1;p=chaz%2Fopenbox diff --git a/openbox/screen.c b/openbox/screen.c index 8a9475ad..f7c71abe 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -418,6 +418,7 @@ void screen_set_desktop(guint num) { GList *it; guint old; + ObClient *target; g_assert(num < screen_num_desktops); @@ -438,16 +439,16 @@ void screen_set_desktop(guint num) /* show windows before hiding the rest to lessen the enter/leave events */ /* show windows from top to bottom */ - for (it = stacking_list; it != NULL; it = it->next) { + for (it = stacking_list; it; it = g_list_next(it)) { if (WINDOW_IS_CLIENT(it->data)) { ObClient *c = it->data; - if (!c->frame->visible && client_should_show(c)) + if (client_should_show(c)) frame_show(c->frame); } } /* hide windows from bottom to top */ - for (it = g_list_last(stacking_list); it != NULL; it = it->prev) { + for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) { if (WINDOW_IS_CLIENT(it->data)) { ObClient *c = it->data; if (c->frame->visible && !client_should_show(c)) @@ -457,7 +458,18 @@ void screen_set_desktop(guint num) event_ignore_queued_enters(); - focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS); + target = focus_fallback_target(OB_FOCUS_FALLBACK_NOFOCUS); + if (target) { + frame_adjust_focus(target->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(target); + } } static void get_row_col(guint d, guint *r, guint *c) @@ -572,7 +584,7 @@ void screen_desktop_popup(guint d, gboolean show) { Rect *a; - if (!show || !config_dialog_desktop) { + if (!show) { pager_popup_hide(desktop_cycle_popup); } else { a = screen_physical_area_monitor(0); @@ -860,10 +872,10 @@ void screen_install_colormap(ObClient *client, gboolean install) XWindowAttributes wa; if (client == NULL) { - if (install) - XInstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst)); - else - XUninstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst)); + if (install) + XInstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst)); + else + XUninstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst)); } else { if (XGetWindowAttributes(ob_display, client->window, &wa) && wa.colormap != None) {