[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/exwm 8ea607ba85 03/10: Passthrough input when explicitl
From: |
Adrián Medraño Calvo |
Subject: |
[elpa] externals/exwm 8ea607ba85 03/10: Passthrough input when explicitly reading events and keys |
Date: |
Mon, 8 Jan 2024 11:05:45 -0500 (EST) |
branch: externals/exwm
commit 8ea607ba8548e193157c5627ca30e3e57431ba5f
Author: Steven Allen <steven@stebalien.com>
Commit: Steven Allen <steven@stebalien.com>
Passthrough input when explicitly reading events and keys
When any of these functions are called, Emacs expects to receive all
input events until they return. Unfortunately, there doesn't appear to
be a reliable way to detect that these functions are currently running
other than advising them.
* exwm-input.el (exwm-input--init): Advise low-level input reading
functions to bind 'exwm-input-line-mode-passthrough' to t when called.
(exwm-input--exit): Unadvise.
(exwm-input--call-with-passthrough): The advice.
(exwm-input--passthrough-functions): The functions we now advise.
---
exwm-input.el | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/exwm-input.el b/exwm-input.el
index 05b021093c..7ffd80f38a 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -102,6 +102,13 @@ defined in `exwm-mode-map' here."
(defconst exwm-input--update-focus-interval 0.01
"Time interval (in seconds) for accumulating input focus update requests.")
+(defconst exwm-input--passthrough-functions '(read-char
+ read-char-exclusive
+ read-key-sequence-vector
+ read-key-sequence
+ read-event)
+ "Low-level functions that read events and need to be exempted from EXWM's
input handling.")
+
(defvar exwm-input--during-command nil
"Indicate whether between `pre-command-hook' and `post-command-hook'.")
@@ -1158,6 +1165,11 @@ One use is to access the keymap bound to KEYS (as prefix
keys) in `char-mode'."
(exwm--log)
(exwm-input--on-minibuffer-exit)))
+(defun exwm-input--call-with-passthrough (function &rest args)
+ "Bind `exwm-input-line-mode-passthrough' and call the specified FUNCTION
with ARGS."
+ (let ((exwm-input-line-mode-passthrough t))
+ (apply function args)))
+
(defun exwm-input--init ()
"Initialize the keyboard module."
(exwm--log)
@@ -1213,7 +1225,10 @@ One use is to access the keymap bound to KEYS (as prefix
keys) in `char-mode'."
(run-with-idle-timer 0 t #'exwm-input--on-echo-area-dirty))
(add-hook 'echo-area-clear-hook #'exwm-input--on-echo-area-clear)
;; Update focus when buffer list updates
- (add-hook 'buffer-list-update-hook #'exwm-input--on-buffer-list-update))
+ (add-hook 'buffer-list-update-hook #'exwm-input--on-buffer-list-update)
+
+ (dolist (fun exwm-input--passthrough-functions)
+ (advice-add fun :around #'exwm-input--call-with-passthrough)))
(defun exwm-input--post-init ()
"The second stage in the initialization of the input module."
@@ -1223,6 +1238,8 @@ One use is to access the keymap bound to KEYS (as prefix
keys) in `char-mode'."
(defun exwm-input--exit ()
"Exit the input module."
(exwm--log)
+ (dolist (fun exwm-input--passthrough-functions)
+ (advice-remove fun #'exwm-input--call-with-passthrough))
(exwm-input--unset-simulation-keys)
(remove-hook 'pre-command-hook #'exwm-input--on-pre-command)
(remove-hook 'post-command-hook #'exwm-input--on-post-command)
- [elpa] externals/exwm updated (56db521a3e -> 798dc60a9b), Adrián Medraño Calvo, 2024/01/08
- [elpa] externals/exwm 6eaa0301f1 04/10: Correctly stop the subordinate Emacs daemon, Adrián Medraño Calvo, 2024/01/08
- [elpa] externals/exwm 0b23607ca3 01/10: Remove exwm-cm, Adrián Medraño Calvo, 2024/01/08
- [elpa] externals/exwm 50681727e3 02/10: Add message-box and message-or-box to exwm-blocking-subrs (fix #874), Adrián Medraño Calvo, 2024/01/08
- [elpa] externals/exwm 9b5e4dc1c0 08/10: Merge branch 'minad.github.com/remove-cm' into externals/exwm, Adrián Medraño Calvo, 2024/01/08
- [elpa] externals/exwm 64d324e6ea 06/10: Merge branch 'Stebalien.github.com/steb/fix-subordinate-daemon' into externals/exwm, Adrián Medraño Calvo, 2024/01/08
- [elpa] externals/exwm 01ae286e49 07/10: Merge branch 'Stebalien.github.com/steb/passthrough-input' into externals/exwm, Adrián Medraño Calvo, 2024/01/08
- [elpa] externals/exwm 8ea607ba85 03/10: Passthrough input when explicitly reading events and keys,
Adrián Medraño Calvo <=
- [elpa] externals/exwm 92fbafee6c 05/10: Update copyright year to 2024, Adrián Medraño Calvo, 2024/01/08
- [elpa] externals/exwm 4192762223 09/10: Merge branch 'minad.github.com/blocking-subrs' into externals/exwm, Adrián Medraño Calvo, 2024/01/08
- [elpa] externals/exwm 798dc60a9b 10/10: ; Shorten docstrings, Adrián Medraño Calvo, 2024/01/08