about summary refs log tree commit diff
path: root/exwm.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2018-11-18T00·00+0000
committerChris Feng <chris.w.feng@gmail.com>2018-11-18T00·00+0000
commit5fde63cc453b080f3436751a1912440664a09663 (patch)
tree28d7a96520c732b16990df1d91b88c2a8ba9b244 /exwm.el
parentd650159648e88ec4a67c126834cd24fed6e3fc24 (diff)
Avoid activating already active X windows
* exwm.el (exwm--on-ClientMessage): On receiving `_NET_ACTIVE_WINDOW'
events, check if the requested X windows are already active.
Diffstat (limited to '')
-rw-r--r--exwm.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/exwm.el b/exwm.el
index 6021f85b01..98b30f9495 100644
--- a/exwm.el
+++ b/exwm.el
@@ -416,16 +416,21 @@
       (exwm-workspace-switch (elt data 0)))
      ;; _NET_ACTIVE_WINDOW.
      ((= type xcb:Atom:_NET_ACTIVE_WINDOW)
-      (let ((buffer (exwm--id->buffer id)))
+      (let ((buffer (exwm--id->buffer id))
+            iconic window)
         (when (buffer-live-p buffer)
           (with-current-buffer buffer
             (when (eq exwm--frame exwm-workspace--current)
-              (when (exwm-layout--iconic-state-p)
+              (setq iconic (exwm-layout--iconic-state-p))
+              (when iconic
                 ;; State change: iconic => normal.
                 (set-window-buffer (frame-selected-window exwm--frame)
                                    (current-buffer)))
               ;; Focus transfer.
-              (select-window (get-buffer-window nil t)))))))
+              (setq window (get-buffer-window nil t))
+              (when (or iconic
+                        (not (eq window (selected-window))))
+                (select-window window)))))))
      ;; _NET_CLOSE_WINDOW.
      ((= type xcb:Atom:_NET_CLOSE_WINDOW)
       (let ((buffer (exwm--id->buffer id)))