Simplify input handling

No functional change.

* exwm-input.el (exwm-input--current-input-mode): New function
indicating keyboard input mode.
(exwm-input--on-KeyPress, exwm-input--update-mode-line): Use
`exwm-input--current-input-mode'.
(exwm-input-grab-keyboard, exwm-input-release-keyboard)
(exwm-input--update-mode-line): Simplify.

* exwh-core.el (exwm--on-KeyPress): Remove variable, use
`exwm--keyboard-grabbed' and `exwm-input--current-input-mode'
instead.
This commit is contained in:
Adrián Medraño Calvo 2018-10-08 12:00:00 +00:00
parent 472f7cb82b
commit dff1ef6a3c
3 changed files with 33 additions and 26 deletions

View file

@ -158,9 +158,7 @@ least SECS seconds later."
(defvar-local exwm--mode-line-format nil) ;save mode-line-format
(defvar-local exwm--floating-frame-position nil) ;set when hidden.
(defvar-local exwm--fixed-size nil) ;fixed size
(defvar-local exwm--keyboard-grabbed nil) ;Keyboard grabbed.
(defvar-local exwm--on-KeyPress ;KeyPress event handler
#'exwm-input--on-KeyPress-line-mode)
(defvar-local exwm--input-mode 'line-mode) ;Keyboard grabbed.
;; Properties
(defvar-local exwm--desktop nil "_NET_WM_DESKTOP.")
(defvar-local exwm-window-type nil "_NET_WM_WINDOW_TYPE.")
@ -252,7 +250,7 @@ least SECS seconds later."
"*Keyboard*"
"---"
["Toggle keyboard mode" exwm-input-toggle-keyboard]
["Send key" exwm-input-send-next-key exwm--keyboard-grabbed]
["Send key" exwm-input-send-next-key (eq exwm--input-mode 'line-mode)]
;; This is merely a reference.
("Send simulation key" :filter
(lambda (&rest _args)