about summary refs log tree commit diff
path: root/exwm-core.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2017-11-24T14·47+0800
committerChris Feng <chris.w.feng@gmail.com>2017-11-24T14·47+0800
commitdd6596b1f41a02021d5b60e823a3ae7e5664c92a (patch)
treea305ba8809974bcc8c8fb1c23835402c86651825 /exwm-core.el
parent589b84040980504f0de7d80771b4ccfd63af4eef (diff)
Another fix for input focus issues
* exwm-core.el (exwm--defer):
* exwm-input.el (exwm-input--update-focus-defer): Avoid unnecessarily
long delay.

* exwm-input.el (exwm-input--on-FocusIn): Filter out FocusIn events
generated as a result of grab/ungrab or when the keyboard is grabbed.
Diffstat (limited to 'exwm-core.el')
-rw-r--r--exwm-core.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/exwm-core.el b/exwm-core.el
index 146594da0a16..2c810dfc647d 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -76,10 +76,12 @@
   (xcb:flush exwm--connection))
 
 (defmacro exwm--defer (secs function &rest args)
-  "Defer the action until SECS seconds later.
+  "Defer the execution of FUNCTION.
 
-The action is to call FUNCTION with arguments ARGS."
-  `(run-with-idle-timer (time-add (or (current-idle-time) 0) ,secs)
+The action is to call FUNCTION with arguments ARGS.  If Emacs is not idle,
+defer the action until Emacs is idle.  Otherwise, defer the action until at
+least SECS seconds later."
+  `(run-with-idle-timer (time-add (or (current-idle-time) (- ,secs)) ,secs)
                         nil
                         ,function
                         ,@args))