about summary refs log tree commit diff
path: root/exwm-input.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2015-08-13T07·33+0800
committerChris Feng <chris.w.feng@gmail.com>2015-08-13T07·33+0800
commitdba43b018d791f59f0462b56a46a4eced2d8a3c1 (patch)
tree4513d964230c4d087fe75a8d203b8aca2611f265 /exwm-input.el
parent07e59e0429c4b13a5036e9a207e37fc02135f599 (diff)
Fix input focus stealing
This was fixed in b755296 but broken by 04e4269.
Diffstat (limited to 'exwm-input.el')
-rw-r--r--exwm-input.el18
1 files changed, 10 insertions, 8 deletions
diff --git a/exwm-input.el b/exwm-input.el
index 0ef72325bb..6b41fff5c7 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -112,20 +112,22 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
   "Update input focus."
   (when exwm-input--focus-window
     (with-current-buffer (window-buffer exwm-input--focus-window)
-      (exwm--log "Set focus on %s" exwm-input--focus-window)
       (if (eq major-mode 'exwm-mode)
           (progn
             (when exwm--floating-frame
               (redirect-frame-focus exwm--floating-frame nil)
               (select-frame-set-input-focus exwm--floating-frame t))
+            (exwm--log "Set focus on #x%x" exwm--id)
             (exwm-input--set-focus exwm--id))
-        (select-frame-set-input-focus (window-frame exwm-input--focus-window)
-                                      t)
-        (dolist (pair exwm--id-buffer-alist)
-          (with-current-buffer (cdr pair)
-            (when (and exwm--floating-frame
-                       (eq exwm--frame exwm-workspace--current))
-              (redirect-frame-focus exwm--floating-frame exwm--frame)))))
+        (when (eq (selected-window) exwm-input--focus-window)
+          (exwm--log "Focus on %s" exwm-input--focus-window)
+          (select-frame-set-input-focus (window-frame exwm-input--focus-window)
+                                        t)
+          (dolist (pair exwm--id-buffer-alist)
+            (with-current-buffer (cdr pair)
+              (when (and exwm--floating-frame
+                         (eq exwm--frame exwm-workspace--current))
+                (redirect-frame-focus exwm--floating-frame exwm--frame))))))
       (setq exwm-input--focus-window nil))))
 
 (defun exwm-input--finish-key-sequence ()