]> Dogcows Code - chaz/openbox/commitdiff
don't steal focus from windows you are typing in, even if the new window is a relative
authorDana Jansens <danakj@orodu.net>
Sun, 2 Mar 2008 18:30:44 +0000 (13:30 -0500)
committerDana Jansens <danakj@orodu.net>
Sun, 2 Mar 2008 18:31:47 +0000 (13:31 -0500)
openbox/client.c

index 816fa922122950c675304a0cb812ae17cdae72ac..98d1035b9c6d0d0377e29f6191a35ca13dd3495e 100644 (file)
@@ -494,6 +494,12 @@ void client_manage(Window window, ObPrompt *prompt)
                   activate ? "yes" : "no");
     if (activate) {
         gboolean raise = FALSE;
+        gboolean relative_focused = FALSE;
+
+        relative_focused = (focus_client != NULL &&
+                            client_search_focus_tree_full(self) != NULL &&
+                            client_search_focus_group_full(self) != NULL);
+
 
         /* This is focus stealing prevention */
         ob_debug_type(OB_DEBUG_FOCUS,
@@ -524,10 +530,8 @@ void client_manage(Window window, ObPrompt *prompt)
                           "Not focusing the window because its on another "
                           "desktop\n");
         }
-        /* If something is focused, and it's not our relative... */
-        else if (focus_client && client_search_focus_tree_full(self) == NULL &&
-                 client_search_focus_group_full(self) == NULL)
-        {
+        /* If something is focused... */
+        else if (focus_client) {
             /* If the user is working in another window right now, then don't
                steal focus */
             if (event_last_user_time && launch_time &&
@@ -541,8 +545,9 @@ void client_manage(Window window, ObPrompt *prompt)
                               "Not focusing the window because the user is "
                               "working in another window\n");
             }
-            /* If it's a transient (and its parents aren't focused) */
-            else if (client_has_parent(self)) {
+            /* If the new window is a transient (and its relatives aren't
+               focused) */
+            else if (client_has_parent(self) && !relative_focused) {
                 activate = FALSE;
                 ob_debug_type(OB_DEBUG_FOCUS,
                               "Not focusing the window because it is a "
@@ -568,8 +573,11 @@ void client_manage(Window window, ObPrompt *prompt)
                               "Not focusing the window because another window "
                               "would get the focus anyway\n");
             }
+            /* Don't move focus if the window is not visible on the current
+               desktop and none of its relatives are focused */
             else if (!(self->desktop == screen_desktop ||
-                       self->desktop == DESKTOP_ALL))
+                       self->desktop == DESKTOP_ALL) &&
+                     !relative_focused)
             {
                 activate = FALSE;
                 raise = TRUE;
This page took 0.033355 seconds and 4 git commands to generate.