about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2015-10-17T03·02+0800
committerChris Feng <chris.w.feng@gmail.com>2015-10-17T03·02+0800
commite70c6fad56d0290890d75322c2f5335173624549 (patch)
tree931dfa31b6268affdc855b07f8a223594b5f4ec5
parent46461d994b32da1813d3e531b02127c7b9281947 (diff)
Allow certain commands to receive key events in line-mode
* exwm-input.el (exwm-input-command-whitelist): New variable.
  (exwm-input--on-KeyPress-line-mode): Allow certain commands which receive
  inputs without using the minibuffer to work in line-mode.
-rw-r--r--exwm-input.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/exwm-input.el b/exwm-input.el
index 6c3485314315..f0bf6aa8b66c 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -270,6 +270,13 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
   (global-set-key key command)
   (cl-pushnew key exwm-input--global-keys))
 
+;; These commands usually call something like `read-char' without using the
+;; minibuffer, so they will not get inputs after invoked.  It'd be better if we
+;; can determine whether there's a command waiting for input so that this
+;; variable can be removed.
+(defvar exwm-input-command-whitelist nil
+  "A list of commands that when active all keys should be forwarded to Emacs.")
+
 ;;;###autoload
 (defun exwm-input--on-KeyPress-line-mode (key-press)
   "Parse X KeyPress event to Emacs key event and then feed the command loop."
@@ -280,6 +287,7 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
                  (setq event (xcb:keysyms:keysym->event keysym state))
                  (or exwm-input--during-key-sequence
                      (setq minibuffer-window (active-minibuffer-window))
+                     (memq real-this-command exwm-input-command-whitelist)
                      (memq event exwm-input--global-prefix-keys)
                      (memq event exwm-input-prefix-keys)
                      (memq event exwm-input--simulation-prefix-keys)))