about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2019-07-28T00·00+0000
committerChris Feng <chris.w.feng@gmail.com>2019-07-28T00·00+0000
commitc5794765362460b5c18fdedb3f77617fb34ee804 (patch)
tree80854b74249b1fb6ba4fd4cc1b391460fbf98b12
parent0a3dde042a6ff671bd728bf1943fd3a743371161 (diff)
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.
-rw-r--r--exwm-workspace.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 183d91a34cfe..a4ccc2f059cb 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