about summary refs log tree commit diff
path: root/exwm.el
diff options
context:
space:
mode:
authorSteven Allen <steven@stebalien.com>2024-04-03T21·08-0700
committerGitHub <noreply@github.com>2024-04-03T21·08-0700
commit236f3ca467ba9d3aa666cb77ece61c6db03b99ce (patch)
tree837b7702c71ee368cf773c9d4953b167420b8c65 /exwm.el
parentbf921084b4a03aa53a806f792ea3b77ca8005114 (diff)
Correctly activate windows even if they're not in the iconic state (#32)
* exwm.el (exwm--on-ClientMessage): Handle the case where a window is
hidden but not iconic. This code would previously error in some cases
because a buffer wouldn't have an active window even when it was not in
the iconic state, likely due to a focus race somewhere.

fixes #28
Diffstat (limited to 'exwm.el')
-rw-r--r--exwm.el15
1 files changed, 6 insertions, 9 deletions
diff --git a/exwm.el b/exwm.el
index c4900eab48ca..fc2792ffab43 100644
--- a/exwm.el
+++ b/exwm.el
@@ -493,23 +493,20 @@ RAW-DATA contains unmarshalled ClientMessage event data."
      ;; _NET_ACTIVE_WINDOW.
      ((= type xcb:Atom:_NET_ACTIVE_WINDOW)
       (let ((buffer (exwm--id->buffer id))
-            iconic window)
+            window)
         (if (buffer-live-p buffer)
           ;; Either an `exwm-mode' buffer (an X window) or a floating frame.
           (with-current-buffer buffer
             (when (eq exwm--frame exwm-workspace--current)
               (if exwm--floating-frame
                   (select-frame exwm--floating-frame)
-                (setq iconic (exwm-layout--iconic-state-p))
-                (when iconic
+                (setq window (get-buffer-window nil t))
+                (unless window
                   ;; State change: iconic => normal.
-                  (set-window-buffer (frame-selected-window exwm--frame)
-                                     (current-buffer)))
+                  (setq window (frame-selected-window exwm--frame))
+                  (set-window-buffer window (current-buffer)))
                 ;; Focus transfer.
-                (setq window (get-buffer-window nil t))
-                (when (or iconic
-                          (not (eq window (selected-window))))
-                  (select-window window)))))
+                (select-window window))))
           ;; A workspace.
           (dolist (f exwm-workspace--list)
             (when (eq id (frame-parameter f 'exwm-outer-id))