From: Dana Jansens Date: Sat, 26 May 2007 21:22:28 +0000 (+0000) Subject: only kill focus cycling when the window being destroyed was in the list of targets X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=aa7c36d1bc78529feafb65c2fd6e251a86043d81;p=chaz%2Fopenbox only kill focus cycling when the window being destroyed was in the list of targets --- diff --git a/openbox/focus.c b/openbox/focus.c index 73099a4b..6713d98d 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -75,7 +75,8 @@ void focus_set_client(ObClient *client) screen_install_colormap(client, TRUE); /* in the middle of cycling..? kill it. */ - focus_cycle_stop(); + focus_cycle_stop(focus_client); + focus_cycle_stop(client); focus_client = client; @@ -208,7 +209,7 @@ void focus_order_add_new(ObClient *c) } /* in the middle of cycling..? kill it. */ - focus_cycle_stop(); + focus_cycle_stop(c); } void focus_order_remove(ObClient *c) @@ -216,7 +217,7 @@ void focus_order_remove(ObClient *c) focus_order = g_list_remove(focus_order, c); /* in the middle of cycling..? kill it. */ - focus_cycle_stop(); + focus_cycle_stop(c); } void focus_order_to_top(ObClient *c) diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c index 4ff098d7..46f5f058 100644 --- a/openbox/focus_cycle.c +++ b/openbox/focus_cycle.c @@ -32,6 +32,7 @@ #include ObClient *focus_cycle_target = NULL; +static gboolean focus_cycle_iconic_windows; static gboolean focus_cycle_all_desktops; static gboolean focus_cycle_dock_windows; static gboolean focus_cycle_desktop_windows; @@ -58,9 +59,17 @@ void focus_cycle_shutdown(gboolean reconfig) if (reconfig) return; } -void focus_cycle_stop() +void focus_cycle_stop(ObClient *ifclient) { - if (focus_cycle_target) { + /* stop focus cycling if the given client is a valid focus target, + and so the cycling is being disrupted */ + if (focus_cycle_target && ifclient && + focus_cycle_target_valid(ifclient, + focus_cycle_iconic_windows, + focus_cycle_all_desktops, + focus_cycle_dock_windows, + focus_cycle_desktop_windows)) + { focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE); focus_directional_cycle(0, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE); } @@ -179,7 +188,8 @@ void focus_cycle(gboolean forward, gboolean all_desktops, if (focus_cycle_target == NULL) { - focus_cycle_all_desktops = FALSE; + focus_cycle_iconic_windows = TRUE; + focus_cycle_all_desktops = all_desktops; focus_cycle_dock_windows = dock_windows; focus_cycle_desktop_windows = desktop_windows; focus_cycle_target = focus_client; @@ -199,7 +209,8 @@ void focus_cycle(gboolean forward, gboolean all_desktops, if (it == NULL) it = g_list_last(list); } ft = it->data; - if (focus_cycle_target_valid(ft, TRUE, + if (focus_cycle_target_valid(ft, + focus_cycle_iconic_windows, focus_cycle_all_desktops, focus_cycle_dock_windows, focus_cycle_desktop_windows)) @@ -211,7 +222,8 @@ void focus_cycle(gboolean forward, gboolean all_desktops, } if (dialog) /* same arguments as focus_target_valid */ - focus_cycle_popup_show(ft, TRUE, + focus_cycle_popup_show(ft, + focus_cycle_iconic_windows, focus_cycle_all_desktops, focus_cycle_dock_windows, focus_cycle_desktop_windows); @@ -356,6 +368,7 @@ void focus_directional_cycle(ObDirection dir, gboolean dock_windows, goto done_cycle; if (focus_cycle_target == NULL) { + focus_cycle_iconic_windows = FALSE; focus_cycle_all_desktops = FALSE; focus_cycle_dock_windows = dock_windows; focus_cycle_desktop_windows = desktop_windows; @@ -371,7 +384,9 @@ void focus_directional_cycle(ObDirection dir, gboolean dock_windows, GList *it; for (it = focus_order; it; it = g_list_next(it)) - if (focus_cycle_target_valid(it->data, FALSE, FALSE, + if (focus_cycle_target_valid(it->data, + focus_cycle_iconic_windows, + focus_cycle_all_desktops, focus_cycle_dock_windows, focus_cycle_desktop_windows)) ft = it->data; @@ -386,7 +401,8 @@ void focus_directional_cycle(ObDirection dir, gboolean dock_windows, if (focus_cycle_target && dialog) { /* same arguments as focus_target_valid */ focus_cycle_popup_single_show(focus_cycle_target, - FALSE, FALSE, + focus_cycle_iconic_windows, + focus_cycle_all_desktops, focus_cycle_dock_windows, focus_cycle_desktop_windows); return; diff --git a/openbox/focus_cycle.h b/openbox/focus_cycle.h index 38c0e837..afdbdc79 100644 --- a/openbox/focus_cycle.h +++ b/openbox/focus_cycle.h @@ -42,7 +42,7 @@ void focus_directional_cycle(ObDirection dir, gboolean dock_windows, gboolean desktop_windows, gboolean interactive, gboolean dialog, gboolean done, gboolean cancel); -void focus_cycle_stop(); +void focus_cycle_stop(struct _ObClient *ifclient); gboolean focus_cycle_target_valid(struct _ObClient *ft, gboolean iconic_windows,