Merge branch 'Stebalien/expose-line-mode-passthrough' into externals/exwm

This commit is contained in:
Chris Feng 2017-02-24 23:30:02 +08:00
commit b79a3c52a5
2 changed files with 13 additions and 14 deletions

View file

@ -80,7 +80,7 @@
(logior xcb:EventMask:StructureNotify xcb:EventMask:PropertyChange)) (logior xcb:EventMask:StructureNotify xcb:EventMask:PropertyChange))
"Event mask set on all managed windows.") "Event mask set on all managed windows.")
(defvar exwm-input--line-mode-passthrough) (defvar exwm-input-line-mode-passthrough)
(defvar exwm-input--global-prefix-keys) (defvar exwm-input--global-prefix-keys)
(defvar exwm-input-prefix-keys) (defvar exwm-input-prefix-keys)
(defvar exwm-input--simulation-prefix-keys) (defvar exwm-input--simulation-prefix-keys)
@ -154,7 +154,7 @@
(lambda () (lambda ()
(interactive) (interactive)
(cond (cond
((or exwm-input--line-mode-passthrough ((or exwm-input-line-mode-passthrough
;; Do not test `exwm-input--during-command'. ;; Do not test `exwm-input--during-command'.
(active-minibuffer-window) (active-minibuffer-window)
(memq last-input-event exwm-input--global-prefix-keys) (memq last-input-event exwm-input--global-prefix-keys)

View file

@ -420,7 +420,7 @@ This value should always be overwritten.")
(defvar exwm-input--during-command nil (defvar exwm-input--during-command nil
"Indicate whether between `pre-command-hook' and `post-command-hook'.") "Indicate whether between `pre-command-hook' and `post-command-hook'.")
(defvar exwm-input--line-mode-passthrough nil (defvar exwm-input-line-mode-passthrough nil
"Non-nil makes 'line-mode' forwards all events to Emacs.") "Non-nil makes 'line-mode' forwards all events to Emacs.")
(defvar exwm-input--line-mode-cache nil "Cache for incomplete key sequence.") (defvar exwm-input--line-mode-cache nil "Cache for incomplete key sequence.")
@ -449,7 +449,7 @@ This value should always be overwritten.")
(setq event (xcb:keysyms:keysym->event (setq event (xcb:keysyms:keysym->event
exwm--connection (car keysym) exwm--connection (car keysym)
(logand state (lognot (cdr keysym))))) (logand state (lognot (cdr keysym)))))
(or exwm-input--line-mode-passthrough (or exwm-input-line-mode-passthrough
exwm-input--during-command exwm-input--during-command
;; Forward the event when there is an incomplete key ;; Forward the event when there is an incomplete key
;; sequence or when the minibuffer is active. ;; sequence or when the minibuffer is active.
@ -629,16 +629,15 @@ This value should always be overwritten.")
(let (key keys) (let (key keys)
(dotimes (i times) (dotimes (i times)
;; Skip events not from keyboard ;; Skip events not from keyboard
(setq exwm-input--line-mode-passthrough t) (let ((exwm-input-line-mode-passthrough t))
(catch 'break (catch 'break
(while t (while t
(setq key (read-key (format "Send key: %s (%d/%d)" (setq key (read-key (format "Send key: %s (%d/%d)"
(key-description keys) (key-description keys)
(1+ i) times))) (1+ i) times)))
(when (and (listp key) (eq (car key) t)) (when (and (listp key) (eq (car key) t))
(setq key (cdr key))) (setq key (cdr key)))
(unless (listp key) (throw 'break nil)))) (unless (listp key) (throw 'break nil)))))
(setq exwm-input--line-mode-passthrough nil)
(setq keys (vconcat keys (vector key))) (setq keys (vconcat keys (vector key)))
(exwm-input--fake-key key)))) (exwm-input--fake-key key))))