]> Dogcows Code - chaz/openbox/commitdiff
only kill focus cycling when the window being destroyed was in the list of targets
authorDana Jansens <danakj@orodu.net>
Sat, 26 May 2007 21:22:28 +0000 (21:22 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 26 May 2007 21:22:28 +0000 (21:22 +0000)
openbox/focus.c
openbox/focus_cycle.c
openbox/focus_cycle.h

index 73099a4bcc688bef43411875de4d9626f4939641..6713d98dd7566535fe8d81cb5d4d0e0a502af652 100644 (file)
@@ -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)
index 4ff098d71cfd8fb75b712256d5b37ebb7db2972a..46f5f058daff1bf5424973dec9693807ff5708e2 100644 (file)
@@ -32,6 +32,7 @@
 #include <glib.h>
 
 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;
index 38c0e8371c95e2e8d8884ebf6cd493ecca59efe6..afdbdc799d049015d7589f582f2a89173424b5e0 100644 (file)
@@ -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,
This page took 0.034111 seconds and 4 git commands to generate.