]> git.lizzy.rs Git - bspwm.git/commitdiff
Trust WM_TAKE_FOCUS but handle exceptions
authorBastien Dejean <nihilhill@gmail.com>
Sat, 7 Nov 2015 09:49:33 +0000 (10:49 +0100)
committerBastien Dejean <nihilhill@gmail.com>
Sat, 7 Nov 2015 09:49:33 +0000 (10:49 +0100)
tree.c
window.c
window.h

diff --git a/tree.c b/tree.c
index 7cbb234e5178466ba18fafa657e0ecaf1b763355..54224db112a3a939465d107f4aa82b9bb67fbe98 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -422,8 +422,9 @@ client_t *make_client(xcb_window_t win, unsigned int border_width)
        c->locked = c->sticky = c->urgent = c->private = c->icccm_focus = false;
        xcb_icccm_get_wm_protocols_reply_t protocols;
        if (xcb_icccm_get_wm_protocols_reply(dpy, xcb_icccm_get_wm_protocols(dpy, win, ewmh->WM_PROTOCOLS), &protocols, NULL) == 1) {
-               if (has_proto(WM_TAKE_FOCUS, &protocols))
+               if (has_proto(WM_TAKE_FOCUS, &protocols)) {
                        c->icccm_focus = true;
+               }
                xcb_icccm_get_wm_protocols_reply_wipe(&protocols);
        }
        c->num_states = 0;
index abd0b26d01e0cc096b0fc4fc601e88f3ee5ec20b..7b7fad39ac0dfb6c7f58b0f92e3b9d8350560012 100644 (file)
--- a/window.c
+++ b/window.c
@@ -840,9 +840,11 @@ void set_input_focus(node_t *n)
        if (n == NULL) {
                clear_input_focus();
        } else {
-               if (n->client->icccm_focus)
+               if (n->client->icccm_focus && strstr(ICCCM_FOCUS_EXCEPTIONS, n->client->class_name) == NULL) {
                        send_client_message(n->client->window, ewmh->WM_PROTOCOLS, WM_TAKE_FOCUS);
-               xcb_set_input_focus(dpy, XCB_INPUT_FOCUS_POINTER_ROOT, n->client->window, XCB_CURRENT_TIME);
+               } else {
+                       xcb_set_input_focus(dpy, XCB_INPUT_FOCUS_POINTER_ROOT, n->client->window, XCB_CURRENT_TIME);
+               }
        }
 }
 
index 1e55947f338671a0b748a7cff58de04335d27f8c..c97b7f7e2f8bb81eb171101aa6d7aac275e38bd3 100644 (file)
--- a/window.h
+++ b/window.h
 #ifndef BSPWM_WINDOW_H
 #define BSPWM_WINDOW_H
 
+/* A comma separated list of class names of programs that include the WM_FOCUS
+ * atom in their WM_PROTOCOLS property but don't handle the corresponding
+ * client message */
+#define ICCCM_FOCUS_EXCEPTIONS  "Skype"
+
 #include <stdarg.h>
 #include <xcb/xcb.h>
 #include <xcb/xcb_event.h>