]> Dogcows Code - chaz/openbox/commitdiff
Hide the focus popup if we change desktops and one of the windows in it disappears
authorDana Jansens <danakj@orodu.net>
Thu, 17 Dec 2009 20:43:46 +0000 (15:43 -0500)
committerDana Jansens <danakj@orodu.net>
Thu, 17 Dec 2009 21:51:01 +0000 (16:51 -0500)
openbox/focus_cycle.c
openbox/focus_cycle_popup.c
openbox/focus_cycle_popup.h
openbox/screen.c

index 20a738f43bc13d017f2a2f181d3306500f3c12f5..8d0474978f8faef00a4467f2cbba1f1e583e9337 100644 (file)
@@ -56,12 +56,8 @@ void focus_cycle_stop(ObClient *ifclient)
     /* 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_valid_target(ifclient, TRUE,
-                           focus_cycle_iconic_windows,
-                           focus_cycle_all_desktops,
-                           focus_cycle_dock_windows,
-                           focus_cycle_desktop_windows,
-                           FALSE))
+        (ifclient == focus_cycle_target ||
+         focus_cycle_popup_is_showing(ifclient)))
     {
         focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,TRUE);
         focus_directional_cycle(0, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
index 740d668817a62ce17fc8bf47e1d95458bf2cc097..d01be03cf02970a119be9ddbc4cb7ee2b6efffef 100644 (file)
@@ -535,3 +535,17 @@ void focus_cycle_popup_single_hide(void)
 {
     icon_popup_hide(single_popup);
 }
+
+gboolean focus_cycle_popup_is_showing(ObClient *client)
+{
+    if (popup.mapped) {
+        GList *it;
+
+        for (it = popup.targets; it; it = g_list_next(it)) {
+            ObFocusCyclePopupTarget *t = it->data;
+            if (t->client == client)
+                return TRUE;
+        }
+    }
+    return FALSE;
+}
index ded39e202896a2c5433ae5e1e187f73d8077a99c..19279a62d43f2232661cd4a7ab896139648ecb5b 100644 (file)
@@ -39,4 +39,7 @@ void focus_cycle_popup_single_show(struct _ObClient *c,
                                    gboolean desktop_windows);
 void focus_cycle_popup_single_hide();
 
+/*! Returns TRUE if the popup is showing the client, otherwise FALSE. */
+gboolean focus_cycle_popup_is_showing(struct _ObClient *client);
+
 #endif
index 76ad1f274803e65f69997a01efd9a14341bc8098..d88be432f1a26965b6103324db9d327ae79df0a1 100644 (file)
@@ -33,6 +33,7 @@
 #include "frame.h"
 #include "event.h"
 #include "focus.h"
+#include "focus_cycle.h"
 #include "popup.h"
 #include "extensions.h"
 #include "render/render.h"
@@ -717,14 +718,21 @@ void screen_set_desktop(guint num, gboolean dofocus)
     for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) {
         if (WINDOW_IS_CLIENT(it->data)) {
             ObClient *c = it->data;
-            if (client_hide(c) && c == focus_client) {
-                /* c was focused and we didn't do fallback clearly so make sure
-                   openbox doesnt still consider the window focused.
-                   this happens when using NextWindow with allDesktops, since
-                   it doesnt want to move focus on desktop change, but the
-                   focus is not going to stay with the current window, which
-                   has now disappeared */
-                focus_set_client(NULL);
+            if (client_hide(c)) {
+                /* in the middle of cycling..? kill it. */
+                focus_cycle_stop(c);
+
+                if (c == focus_client) {
+                    /* c was focused and we didn't do fallback clearly so make
+                       sure openbox doesnt still consider the window focused.
+                       this happens when using NextWindow with allDesktops,
+                       since it doesnt want to move focus on desktop change,
+                       but the focus is not going to stay with the current
+                       window, which has now disappeared.
+                       only do this if the client was actually hidden,
+                       otherwise it can keep focus. */
+                    focus_set_client(NULL);
+                }
             }
         }
     }
This page took 0.026811 seconds and 4 git commands to generate.