[DRAFT] Keep input mode when switching to fullscreen

This commit is contained in:
Adrián Medraño Calvo 2024-08-20 00:00:00 +00:00
parent 42996da86d
commit 64e0b237fb
2 changed files with 15 additions and 6 deletions

View file

@ -256,6 +256,8 @@ If CONN is non-nil, use it instead of the value of the variable
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.")
(defvar-local exwm--fullscreen-previous-configuration nil
"Stores window configuration to restore when unsetting fullscreen.")
;; Properties
(defvar-local exwm--desktop nil "_NET_WM_DESKTOP.")
(defvar-local exwm-window-type nil "_NET_WM_WINDOW_TYPE.")

View file

@ -209,10 +209,14 @@ See variable `exwm-layout-auto-iconify'."
:stack-mode xcb:StackMode:Above))
(cl-pushnew xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)
(exwm-layout--set-ewmh-state exwm--id)
(unless exwm--floating-frame
;; Store window configuration and leave the window of the buffer's window
;; as the sole window. This makes commands such as `other-window` more
;; intuitive.
(setq exwm--fullscreen-previous-configuration (current-window-configuration))
(delete-other-windows))
(xcb:flush exwm--connection)
(set-window-dedicated-p (get-buffer-window) t)
(when (eq 'char-mode exwm--selected-input-mode)
(exwm-input--release-keyboard exwm--id))))
(set-window-dedicated-p (get-buffer-window) t)))
;;;###autoload
(cl-defun exwm-layout-unset-fullscreen (&optional id)
@ -230,6 +234,11 @@ See variable `exwm-layout-auto-iconify'."
(exwm-layout--set-ewmh-state exwm--id)
(if exwm--floating-frame
(exwm-layout--show exwm--id (frame-root-window exwm--floating-frame))
(when exwm--fullscreen-previous-configuration
;; Restore the window configuration as it was before switching to
;; fullscreen.
(set-window-configuration exwm--fullscreen-previous-configuration)
(setq exwm--fullscreen-previous-configuration nil))
(xcb:+request exwm--connection
(make-instance 'xcb:ConfigureWindow
:window exwm--id
@ -241,9 +250,7 @@ See variable `exwm-layout-auto-iconify'."
(when window
(exwm-layout--show exwm--id window))))
(xcb:flush exwm--connection)
(set-window-dedicated-p (get-buffer-window) nil)
(when (eq 'line-mode exwm--selected-input-mode)
(exwm-input--grab-keyboard exwm--id))))
(set-window-dedicated-p (get-buffer-window) nil)))
;;;###autoload
(defun exwm-layout-toggle-fullscreen (&optional id)