Fix `after-focus-change-function' not working

* exwm-workspace.el (exwm-workspace--original-handle-focus-in)
(exwm-workspace--original-handle-focus-out): Store the original
`handle-focus-{in,out}'.
(exwm-workspace-switch): Now that `handle-focus-{in,out}' has been
updated to call other stuffs like `after-focus-change-function', we
can no longer run `focus-{in,out}-hook' only.
This commit is contained in:
Chris Feng 2019-07-28 00:00:00 +00:00
parent 0a3dde042a
commit c579476536

View file

@ -106,6 +106,11 @@ Please manually run the hook `exwm-workspace-list-change-hook' afterwards.")
(defvar exwm-workspace--minibuffer nil (defvar exwm-workspace--minibuffer nil
"The minibuffer frame shared among all frames.") "The minibuffer frame shared among all frames.")
(defvar exwm-workspace--original-handle-focus-in
(symbol-function #'handle-focus-in))
(defvar exwm-workspace--original-handle-focus-out
(symbol-function #'handle-focus-out))
(defvar exwm-workspace--prompt-add-allowed nil (defvar exwm-workspace--prompt-add-allowed nil
"Non-nil to allow adding workspace from the prompt.") "Non-nil to allow adding workspace from the prompt.")
@ -648,8 +653,9 @@ for internal use only."
(when (and (not (eq frame old-frame)) (when (and (not (eq frame old-frame))
(frame-live-p old-frame)) (frame-live-p old-frame))
(with-selected-frame old-frame (with-selected-frame old-frame
(run-hooks 'focus-out-hook))) (funcall exwm-workspace--original-handle-focus-out
(run-hooks 'focus-in-hook) (list 'focus-out frame))))
(funcall exwm-workspace--original-handle-focus-in (list 'focus-in frame))
(run-hooks 'exwm-workspace-switch-hook))) (run-hooks 'exwm-workspace-switch-hook)))
;;;###autoload ;;;###autoload