Allow selecting an X window from another workspace

* exwm-input.el (exwm-input--on-buffer-list-update): Filter out
switch-frame events.
(exwm-input--update-focus): Switch workspace to set input focus on an X
window from another workspace.
This commit is contained in:
Chris Feng 2016-09-23 18:24:37 +08:00
parent f96f565d54
commit 84dad20d66

View file

@ -160,6 +160,7 @@ This value should always be overwritten.")
"Run in `buffer-list-update-hook' to track input focus." "Run in `buffer-list-update-hook' to track input focus."
(when (and (not (minibufferp)) ;Do not set input focus on minibuffer window. (when (and (not (minibufferp)) ;Do not set input focus on minibuffer window.
(eq (current-buffer) (window-buffer)) ;e.g. `with-temp-buffer'. (eq (current-buffer) (window-buffer)) ;e.g. `with-temp-buffer'.
(not (eq this-command #'handle-switch-frame))
(not (exwm-workspace--client-p))) (not (exwm-workspace--client-p)))
(setq exwm-input--update-focus-window (selected-window)) (setq exwm-input--update-focus-window (selected-window))
(exwm-input--update-focus-defer))) (exwm-input--update-focus-defer)))
@ -214,14 +215,7 @@ This value should always be overwritten.")
(with-current-buffer (window-buffer window) (with-current-buffer (window-buffer window)
(if (eq major-mode 'exwm-mode) (if (eq major-mode 'exwm-mode)
(if (not (eq exwm--frame exwm-workspace--current)) (if (not (eq exwm--frame exwm-workspace--current))
;; Do not focus X windows on other workspace. (exwm-workspace-switch exwm--frame)
(progn
(set-frame-parameter exwm--frame 'exwm-urgency t)
(setq exwm-workspace--switch-history-outdated t)
(force-mode-line-update)
;; The application may have changed its input focus
(select-window
(frame-selected-window exwm-workspace--current)))
(exwm--log "Set focus on #x%x" exwm--id) (exwm--log "Set focus on #x%x" exwm--id)
(exwm-input--set-focus exwm--id) (exwm-input--set-focus exwm--id)
(when exwm--floating-frame (when exwm--floating-frame