]> Dogcows Code - chaz/openbox/blobdiff - openbox/focus.c
Merge branch 'backport' into work
[chaz/openbox] / openbox / focus.c
index baf88e8134bcc8227c8706cdbae849184781da7e..a75c170f649e72bf62c07456e603742e976e1229 100644 (file)
@@ -27,7 +27,6 @@
 #include "focus_cycle.h"
 #include "screen.h"
 #include "keyboard.h"
-#include "hooks.h"
 #include "focus.h"
 #include "stacking.h"
 #include "obt/prop.h"
@@ -73,7 +72,6 @@ static void push_to_top(ObClient *client)
 void focus_set_client(ObClient *client)
 {
     Window active;
-    ObClient *old;
 
     ob_debug_type(OB_DEBUG_FOCUS,
                   "focus_set_client 0x%lx", client ? client->window : 0);
@@ -85,11 +83,6 @@ void focus_set_client(ObClient *client)
     screen_install_colormap(focus_client, FALSE);
     screen_install_colormap(client, TRUE);
 
-    /* in the middle of cycling..? kill it. */
-    focus_cycle_stop(focus_client);
-    focus_cycle_stop(client);
-
-    old = focus_client;
     focus_client = client;
 
     if (client != NULL) {
@@ -104,9 +97,6 @@ void focus_set_client(ObClient *client)
         active = client ? client->window : None;
         OBT_PROP_SET32(obt_root(ob_screen), NET_ACTIVE_WINDOW, WINDOW, active);
     }
-
-    hooks_queue(OB_HOOK_WIN_UNFOCUS, old);
-    hooks_queue(OB_HOOK_WIN_FOCUS, client);
 }
 
 static ObClient* focus_fallback_target(gboolean allow_refocus,
@@ -139,7 +129,7 @@ static ObClient* focus_fallback_target(gboolean allow_refocus,
            3. it is not shaded
         */
         if ((allow_omnipresent || c->desktop == screen_desktop) &&
-            focus_valid_target(c, TRUE, FALSE, FALSE, FALSE, FALSE) &&
+            focus_valid_target(c, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE) &&
             !c->shaded &&
             (allow_refocus || client_focus_target(c) != old) &&
             client_focus(c))
@@ -159,7 +149,7 @@ static ObClient* focus_fallback_target(gboolean allow_refocus,
            a splashscreen or a desktop window (save the desktop as a
            backup fallback though)
         */
-        if (focus_valid_target(c, TRUE, FALSE, FALSE, FALSE, TRUE) &&
+        if (focus_valid_target(c, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE) &&
             (allow_refocus || client_focus_target(c) != old) &&
             client_focus(c))
         {
@@ -193,17 +183,9 @@ ObClient* focus_fallback(gboolean allow_refocus, gboolean allow_pointer,
 
 void focus_nothing(void)
 {
-    /* Install our own colormap */
-    if (focus_client != NULL) {
-        screen_install_colormap(focus_client, FALSE);
-        screen_install_colormap(NULL, TRUE);
-    }
-
     /* nothing is focused, update the colormap and _the root property_ */
     focus_set_client(NULL);
 
-    event_cancel_all_key_grabs();
-
     /* when nothing will be focused, send focus to the backup target */
     XSetInputFocus(obt_display, screen_support_win, RevertToPointerRoot,
                    event_curtime);
@@ -292,7 +274,7 @@ static gboolean focus_target_has_siblings(ObClient *ft,
         /* check that it's not a helper window to avoid infinite recursion */
         if (c != ft && c->type == OB_CLIENT_TYPE_NORMAL &&
             focus_valid_target(c, TRUE, iconic_windows, all_desktops,
-                               FALSE, FALSE))
+                               FALSE, FALSE, FALSE))
         {
             return TRUE;
         }
@@ -305,7 +287,8 @@ gboolean focus_valid_target(ObClient *ft,
                             gboolean iconic_windows,
                             gboolean all_desktops,
                             gboolean dock_windows,
-                            gboolean desktop_windows)
+                            gboolean desktop_windows,
+                            gboolean user_request)
 {
     gboolean ok = FALSE;
 
@@ -344,9 +327,11 @@ gboolean focus_valid_target(ObClient *ft,
                !focus_target_has_siblings(ft, iconic_windows, all_desktops))));
 
     /* it's not set to skip the taskbar (but this only applies to normal typed
-       windows, and is overridden if the window is modal) */
+       windows, and is overridden if the window is modal or if the user asked
+       for this window to be focused) */
     ok = ok && (ft->type != OB_CLIENT_TYPE_NORMAL ||
                 ft->modal ||
+                user_request ||
                 !ft->skip_taskbar);
 
     /* it's not going to just send focus off somewhere else (modal window),
@@ -359,7 +344,8 @@ gboolean focus_valid_target(ObClient *ft,
                                                      iconic_windows,
                                                      all_desktops,
                                                      dock_windows,
-                                                     desktop_windows));
+                                                     desktop_windows,
+                                                     FALSE));
     }
 
     return ok;
This page took 0.022558 seconds and 4 git commands to generate.