mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-27 14:57:59 +01:00
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.
This commit is contained in:
parent
e6892216a6
commit
2efd7495d9
2 changed files with 9 additions and 2 deletions
|
@ -117,6 +117,9 @@ defined in `exwm-mode-map' here."
|
||||||
|
|
||||||
(defvar exwm-input--simulation-keys nil "Simulation keys in line-mode.")
|
(defvar exwm-input--simulation-keys nil "Simulation keys in line-mode.")
|
||||||
|
|
||||||
|
(defvar exwm-input--skip-buffer-list-update nil
|
||||||
|
"Skip the upcoming 'buffer-list-update'.")
|
||||||
|
|
||||||
(defvar exwm-input--temp-line-mode nil
|
(defvar exwm-input--temp-line-mode nil
|
||||||
"Non-nil indicates it's in temporary line-mode for char-mode.")
|
"Non-nil indicates it's in temporary line-mode for char-mode.")
|
||||||
|
|
||||||
|
@ -264,6 +267,7 @@ ARGS are additional arguments to CALLBACK."
|
||||||
(defun exwm-input--on-buffer-list-update ()
|
(defun exwm-input--on-buffer-list-update ()
|
||||||
"Run in `buffer-list-update-hook' to track input focus."
|
"Run in `buffer-list-update-hook' to track input focus."
|
||||||
(when (and (not (eq this-command #'handle-switch-frame))
|
(when (and (not (eq this-command #'handle-switch-frame))
|
||||||
|
(not exwm-input--skip-buffer-list-update)
|
||||||
(not (exwm-workspace--client-p))
|
(not (exwm-workspace--client-p))
|
||||||
;; The following conditions filter out events relating to temp
|
;; The following conditions filter out events relating to temp
|
||||||
;; buffers.
|
;; buffers.
|
||||||
|
|
|
@ -91,6 +91,7 @@ You can still make the X windows floating afterwards."
|
||||||
(defvar exwm-manage--ping-lock nil
|
(defvar exwm-manage--ping-lock nil
|
||||||
"Non-nil indicates EXWM is pinging a window.")
|
"Non-nil indicates EXWM is pinging a window.")
|
||||||
|
|
||||||
|
(defvar exwm-input--skip-buffer-list-update)
|
||||||
(defvar exwm-input-prefix-keys)
|
(defvar exwm-input-prefix-keys)
|
||||||
(defvar exwm-workspace--current)
|
(defvar exwm-workspace--current)
|
||||||
(defvar exwm-workspace--id-struts-alist)
|
(defvar exwm-workspace--id-struts-alist)
|
||||||
|
@ -201,7 +202,8 @@ You can still make the X windows floating afterwards."
|
||||||
(make-instance 'xcb:ChangeSaveSet
|
(make-instance 'xcb:ChangeSaveSet
|
||||||
:mode xcb:SetMode:Insert
|
:mode xcb:SetMode:Insert
|
||||||
:window id))
|
: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.
|
;; Keep the oldest X window first.
|
||||||
(setq exwm--id-buffer-alist
|
(setq exwm--id-buffer-alist
|
||||||
(nconc exwm--id-buffer-alist `((,id . ,(current-buffer)))))
|
(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)))
|
:stack-mode xcb:StackMode:Below)))
|
||||||
(xcb:flush exwm--connection)
|
(xcb:flush exwm--connection)
|
||||||
(setq exwm--id-buffer-alist (assq-delete-all id exwm--id-buffer-alist))
|
(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)))
|
(kill-buffer (current-buffer)))
|
||||||
(throw 'return 'ignored))
|
(throw 'return 'ignored))
|
||||||
(let ((index (plist-get exwm--configurations 'workspace)))
|
(let ((index (plist-get exwm--configurations 'workspace)))
|
||||||
|
|
Loading…
Reference in a new issue