about summary refs log tree commit diff
path: root/exwm-manage.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2018-12-16T00·00+0000
committerChris Feng <chris.w.feng@gmail.com>2018-12-16T00·00+0000
commit2efd7495d9755e12a611dbf27dac6057287cd590 (patch)
treebbff92c47bc9d25ac71b943a6d065ab07b1ce9de /exwm-manage.el
parente6892216a6851307c822a71841ad2dc986facb77 (diff)
Avoid unnecessary focus changes when creating/killing buffers
* exwm-input.el (exwm-input--skip-buffer-list-update): New internal
variable for skipping the next 'buffer-list-update'.
(exwm-input--on-buffer-list-update): Skip when
`exwm-input--skip-buffer-list-update` is set.

* exwm-manage.el (exwm-manage--manage-window): Set
`exwm-input--skip-buffer-list-update` when creating/killing buffers.
Diffstat (limited to 'exwm-manage.el')
-rw-r--r--exwm-manage.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/exwm-manage.el b/exwm-manage.el
index 7000c53a6f55..6bb26f228d20 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -91,6 +91,7 @@ You can still make the X windows floating afterwards."
 (defvar exwm-manage--ping-lock nil
   "Non-nil indicates EXWM is pinging a window.")
 
+(defvar exwm-input--skip-buffer-list-update)
 (defvar exwm-input-prefix-keys)
 (defvar exwm-workspace--current)
 (defvar exwm-workspace--id-struts-alist)
@@ -201,7 +202,8 @@ You can still make the X windows floating afterwards."
         (make-instance 'xcb:ChangeSaveSet
                        :mode xcb:SetMode:Insert
                        :window id))
-    (with-current-buffer (generate-new-buffer "*EXWM*")
+    (with-current-buffer (let ((exwm-input--skip-buffer-list-update t))
+                           (generate-new-buffer "*EXWM*"))
       ;; Keep the oldest X window first.
       (setq exwm--id-buffer-alist
             (nconc exwm--id-buffer-alist `((,id . ,(current-buffer)))))
@@ -284,7 +286,8 @@ You can still make the X windows floating afterwards."
                              :stack-mode xcb:StackMode:Below)))
         (xcb:flush exwm--connection)
         (setq exwm--id-buffer-alist (assq-delete-all id exwm--id-buffer-alist))
-        (let ((kill-buffer-query-functions nil))
+        (let ((kill-buffer-query-functions nil)
+              (exwm-input--skip-buffer-list-update t))
           (kill-buffer (current-buffer)))
         (throw 'return 'ignored))
       (let ((index (plist-get exwm--configurations 'workspace)))