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)
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);
*/
focus_set_client(NULL);
- if (config_focus_follow && focus_under_pointer())
- return;
+ if (!config_focus_last && config_focus_follow)
+ if (focus_under_pointer())
+ return;
if (type == OB_FOCUS_FALLBACK_UNFOCUSING && old) {
/* try for transient relations */
static ObClient *t = NULL;
static GList *order = NULL;
GList *it, *start, *list;
- ObClient *ft;
+ ObClient *ft = NULL;
if (cancel) {
if (focus_cycle_target)