Restore keyboard grabbing after exiting fullscreen

Recover the difference between the input mode selected by the user and
actual one, which might be transient.  This was inadvertently removed in
recent changes.

* exwm-core.el (exwm--selected-input-mode): New variable.
* exwm-input.el (exwm-input-grab-keyboard)
(exwm-input-release-keyboard): Use it.
* exwm-layout.el (exwm-layout-unset-fullscreen): Return to the
selected input mode.
This commit is contained in:
Adrián Medraño Calvo 2018-10-21 12:00:00 +00:00
parent dba1ed94c2
commit eb91ee2c77
3 changed files with 8 additions and 2 deletions

View file

@ -158,7 +158,11 @@ least SECS seconds later."
(defvar-local exwm--mode-line-format nil) ;save mode-line-format (defvar-local exwm--mode-line-format nil) ;save mode-line-format
(defvar-local exwm--floating-frame-position nil) ;set when hidden. (defvar-local exwm--floating-frame-position nil) ;set when hidden.
(defvar-local exwm--fixed-size nil) ;fixed size (defvar-local exwm--fixed-size nil) ;fixed size
(defvar-local exwm--input-mode 'line-mode) ;Keyboard grabbed. (defvar-local exwm--selected-input-mode 'line-mode
"Input mode as selected by the user.
One of `line-mode' or `char-mode'.")
(defvar-local exwm--input-mode 'line-mode
"Actual input mode, i.e. whether mouse and keyboard are grabbed.")
;; Properties ;; Properties
(defvar-local exwm--desktop nil "_NET_WM_DESKTOP.") (defvar-local exwm--desktop nil "_NET_WM_DESKTOP.")
(defvar-local exwm-window-type nil "_NET_WM_WINDOW_TYPE.") (defvar-local exwm-window-type nil "_NET_WM_WINDOW_TYPE.")

View file

@ -756,6 +756,7 @@ button event."
(exwm--buffer->id (window-buffer))))) (exwm--buffer->id (window-buffer)))))
(when id (when id
(exwm--log "id=#x%x" id) (exwm--log "id=#x%x" id)
(setq exwm--selected-input-mode 'line-mode)
(exwm-input--grab-keyboard id) (exwm-input--grab-keyboard id)
(exwm-input--update-mode-line id))) (exwm-input--update-mode-line id)))
@ -766,6 +767,7 @@ button event."
(exwm--buffer->id (window-buffer))))) (exwm--buffer->id (window-buffer)))))
(when id (when id
(exwm--log "id=#x%x" id) (exwm--log "id=#x%x" id)
(setq exwm--selected-input-mode 'char-mode)
(exwm-input--release-keyboard id) (exwm-input--release-keyboard id)
(exwm-input--update-mode-line id))) (exwm-input--update-mode-line id)))

View file

@ -199,7 +199,7 @@
(make-instance 'xcb:ewmh:set-_NET_WM_STATE :window exwm--id :data [])) (make-instance 'xcb:ewmh:set-_NET_WM_STATE :window exwm--id :data []))
(xcb:flush exwm--connection) (xcb:flush exwm--connection)
(set-window-dedicated-p (get-buffer-window) nil) (set-window-dedicated-p (get-buffer-window) nil)
(when (eq 'line-mode exwm--input-mode) (when (eq 'line-mode exwm--selected-input-mode)
(exwm-input--grab-keyboard exwm--id)))) (exwm-input--grab-keyboard exwm--id))))
;;;###autoload ;;;###autoload