From c5794765362460b5c18fdedb3f77617fb34ee804 Mon Sep 17 00:00:00 2001 From: Chris Feng Date: Sun, 28 Jul 2019 00:00:00 +0000 Subject: [PATCH] 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. --- exwm-workspace.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/exwm-workspace.el b/exwm-workspace.el index 183d91a34..a4ccc2f05 100644 --- a/exwm-workspace.el +++ b/exwm-workspace.el @@ -106,6 +106,11 @@ Please manually run the hook `exwm-workspace-list-change-hook' afterwards.") (defvar exwm-workspace--minibuffer nil "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 "Non-nil to allow adding workspace from the prompt.") @@ -648,8 +653,9 @@ for internal use only." (when (and (not (eq frame old-frame)) (frame-live-p old-frame)) (with-selected-frame old-frame - (run-hooks 'focus-out-hook))) - (run-hooks 'focus-in-hook) + (funcall exwm-workspace--original-handle-focus-out + (list 'focus-out frame)))) + (funcall exwm-workspace--original-handle-focus-in (list 'focus-in frame)) (run-hooks 'exwm-workspace-switch-hook))) ;;;###autoload