about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2018-08-05T00·00+0000
committerChris Feng <chris.w.feng@gmail.com>2018-08-05T00·00+0000
commitaebcb0344f18b1aa284a432811175fde2d2feae5 (patch)
treeb2f4a29247424ded150ca7744c9d18053e45c5c4
parent13a14579cc1bb772735f895dd5b4b90c6812f3ee (diff)
When mapping an X window check if it's on an active workspace
* exwm-layout.el (exwm-layout--refresh): Avoid mapping X windows on
inactive workspaces.
-rw-r--r--exwm-layout.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/exwm-layout.el b/exwm-layout.el
index 1d3de291a78a..8c86bbd37b92 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -48,6 +48,7 @@
 (declare-function exwm-input--release-keyboard "exwm-input.el")
 (declare-function exwm-input--grab-keyboard "exwm-input.el")
 (declare-function exwm-input-grab-keyboard "exwm-input.el")
+(declare-function exwm-workspace--active-p "exwm-workspace.el" (frame))
 (declare-function exwm-workspace--client-p "exwm-workspace.el"
                   (&optional frame))
 (declare-function exwm-workspace--minibuffer-own-frame-p "exwm-workspace.el")
@@ -272,7 +273,9 @@ selected by `other-buffer'."
                            ;; It may be a buffer waiting to be killed.
                            (exwm--id->buffer exwm--id))
                   (exwm--log "Refresh floating window #x%x" exwm--id)
-                  (exwm-layout--show exwm--id window))))
+                  (if (exwm-workspace--active-p exwm--frame)
+                      (exwm-layout--show exwm--id window)
+                    (exwm-layout--hide exwm--id)))))
           ;; Other frames (e.g. terminal/graphical frame of emacsclient)
           ;; We shall bury all `exwm-mode' buffers in this case
           (setq windows (window-list frame 0)) ;exclude minibuffer
@@ -292,11 +295,11 @@ selected by `other-buffer'."
                          (eq frame exwm--frame)))
             (setq windows (get-buffer-window-list (current-buffer) 0))
             (if (not windows)
-                (when (eq frame exwm--frame) ;for exwm-layout-show-all-buffers
-                  (exwm-layout--hide exwm--id))
+                (exwm-layout--hide exwm--id)
               (let ((window (car windows)))
                 (if (eq frame exwm--frame)
-                    (exwm-layout--show exwm--id window)
+                    (when (exwm-workspace--active-p frame)
+                      (exwm-layout--show exwm--id window))
                   (exwm-workspace-move-window frame exwm--id))
                 ;; Make sure this buffer is not displayed elsewhere.  Note down
                 ;; windows displaying an EXWM-buffer now displayed elsewhere; we