]> git.sur5r.net Git - i3/i3/blobdiff - src/x.c
Dont set input focus and send WM_TAKE_FOCUS
[i3/i3] / src / x.c
diff --git a/src/x.c b/src/x.c
index 0088ab881a8e62648f5e4141180ee2646152defb..02fc338fb12826e655109633a00dd1b6530d1010 100644 (file)
--- a/src/x.c
+++ b/src/x.c
@@ -1006,20 +1006,16 @@ void x_push_changes(Con *con) {
             /* Invalidate focused_id to correctly focus new windows with the same ID */
             focused_id = XCB_NONE;
         } else {
-            bool set_focus = true;
             if (focused->window != NULL &&
-                focused->window->needs_take_focus) {
+                focused->window->needs_take_focus &&
+                focused->window->doesnt_accept_focus) {
                 DLOG("Updating focus by sending WM_TAKE_FOCUS to window 0x%08x (focused: %p / %s)\n",
                      to_focus, focused, focused->name);
                 send_take_focus(to_focus, last_timestamp);
-                set_focus = !focused->window->doesnt_accept_focus;
-                DLOG("set_focus = %d\n", set_focus);
 
-                if (!set_focus && to_focus != last_focused && is_con_attached(focused))
+                if (to_focus != last_focused && is_con_attached(focused))
                    ipc_send_window_event("focus", focused);
-            }
-
-            if (set_focus) {
+            } else {
                 DLOG("Updating focus (focused: %p / %s) to X11 window 0x%08x\n", focused, focused->name, to_focus);
                 /* We remove XCB_EVENT_MASK_FOCUS_CHANGE from the event mask to get
                  * no focus change events for our own focus changes. We only want