X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Ffocus.c;h=eac0dce1ce6435cf7bc41cb53977446fc08db950;hb=adb9bb700f3235728dacc1d3e3daad81abd93e9a;hp=541cf0101453b461e45726aa42424c7c0cef7d83;hpb=f595277f1c9c5359fc8a1dc0a0f190333a464779;p=chaz%2Fopenbox diff --git a/openbox/focus.c b/openbox/focus.c index 541cf010..eac0dce1 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -42,13 +42,23 @@ ObClient *focus_cycle_target; static ObIconPopup *focus_cycle_popup; +static void focus_cycle_destructor(ObClient *c) +{ + /* end cycling if the target disappears */ + if (focus_cycle_target == c) + focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE); +} + void focus_startup(gboolean reconfig) { focus_cycle_popup = icon_popup_new(TRUE); - if (!reconfig) + if (!reconfig) { + client_add_destructor((GDestroyNotify) focus_cycle_destructor); + /* start with nothing focused */ focus_set_client(NULL); + } } void focus_shutdown(gboolean reconfig) @@ -58,6 +68,8 @@ void focus_shutdown(gboolean reconfig) icon_popup_free(focus_cycle_popup); if (!reconfig) { + client_remove_destructor((GDestroyNotify) focus_cycle_destructor); + for (i = 0; i < screen_num_desktops; ++i) g_list_free(focus_order[i]); g_free(focus_order); @@ -225,7 +237,7 @@ void focus_fallback(ObFocusFallbackType type) static void popup_cycle(ObClient *c, gboolean show) { - if (!show) { + if (!show || !config_dialog_focus) { icon_popup_hide(focus_cycle_popup); } else { Rect *a; @@ -282,7 +294,7 @@ void focus_cycle(gboolean forward, gboolean linear, static ObClient *t = NULL; static GList *order = NULL; GList *it, *start, *list; - ObClient *ft; + ObClient *ft = NULL; if (cancel) { if (focus_cycle_target)