mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-27 13:07:59 +01:00
Fix fullscreen mode after switching workspace and back
* exwm-layout.el (exwm-layout--show): Always set an X window in fullscreen mode the size in fullscreen. (exwm-layout-unset-fullscreen): Leave the fullscreen mode first. * exwm-layout.el (exwm-layout--fullscreen-p): New function telling whether the current buffer is in fullscreen mode. (exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen) (exwm-layout-toggle-fullscreen): * exwm-manage.el (exwm-manage--manage-window) (exwm-manage--on-ConfigureRequest): * exwm-workspace.el (exwm-workspace-switch, exwm-workspace-swap) (exwm-workspace-move): * exwm.el (exwm-reset, exwm--on-ClientMessage): Use it.
This commit is contained in:
parent
277377c718
commit
46fe764634
4 changed files with 32 additions and 20 deletions
|
@ -69,6 +69,10 @@
|
||||||
(buffer-local-value 'exwm-state (exwm--id->buffer id))
|
(buffer-local-value 'exwm-state (exwm--id->buffer id))
|
||||||
exwm-state)))
|
exwm-state)))
|
||||||
|
|
||||||
|
(defun exwm-layout--fullscreen-p ()
|
||||||
|
(when (derived-mode-p 'exwm-mode)
|
||||||
|
(memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)))
|
||||||
|
|
||||||
(defun exwm-layout--show (id &optional window)
|
(defun exwm-layout--show (id &optional window)
|
||||||
"Show window ID exactly fit in the Emacs window WINDOW."
|
"Show window ID exactly fit in the Emacs window WINDOW."
|
||||||
(exwm--log "Show #x%x in %s" id window)
|
(exwm--log "Show #x%x in %s" id window)
|
||||||
|
@ -92,6 +96,16 @@
|
||||||
(exwm--set-geometry (frame-parameter exwm--floating-frame
|
(exwm--set-geometry (frame-parameter exwm--floating-frame
|
||||||
'exwm-container)
|
'exwm-container)
|
||||||
frame-x frame-y frame-width frame-height))
|
frame-x frame-y frame-width frame-height))
|
||||||
|
(when (exwm-layout--fullscreen-p)
|
||||||
|
(with-slots ((x* x)
|
||||||
|
(y* y)
|
||||||
|
(width* width)
|
||||||
|
(height* height))
|
||||||
|
(exwm-workspace--get-geometry exwm--frame)
|
||||||
|
(setq x x*
|
||||||
|
y y*
|
||||||
|
width width*
|
||||||
|
height height*)))
|
||||||
(exwm--set-geometry id x y width height)
|
(exwm--set-geometry id x y width height)
|
||||||
(xcb:+request exwm--connection (make-instance 'xcb:MapWindow :window id))
|
(xcb:+request exwm--connection (make-instance 'xcb:MapWindow :window id))
|
||||||
(exwm-layout--set-state id xcb:icccm:WM_STATE:NormalState)))
|
(exwm-layout--set-state id xcb:icccm:WM_STATE:NormalState)))
|
||||||
|
@ -131,7 +145,7 @@
|
||||||
"Make window ID fullscreen."
|
"Make window ID fullscreen."
|
||||||
(interactive)
|
(interactive)
|
||||||
(unless (and (or id (derived-mode-p 'exwm-mode))
|
(unless (and (or id (derived-mode-p 'exwm-mode))
|
||||||
(not (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)))
|
(not (exwm-layout--fullscreen-p)))
|
||||||
(cl-return-from 'exwm-layout-set-fullscreen))
|
(cl-return-from 'exwm-layout-set-fullscreen))
|
||||||
(with-current-buffer (if id (exwm--id->buffer id) (window-buffer))
|
(with-current-buffer (if id (exwm--id->buffer id) (window-buffer))
|
||||||
;; Expand the X window to fill the whole screen.
|
;; Expand the X window to fill the whole screen.
|
||||||
|
@ -158,9 +172,11 @@
|
||||||
"Restore window from fullscreen state."
|
"Restore window from fullscreen state."
|
||||||
(interactive)
|
(interactive)
|
||||||
(unless (and (or id (derived-mode-p 'exwm-mode))
|
(unless (and (or id (derived-mode-p 'exwm-mode))
|
||||||
(memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
|
(exwm-layout--fullscreen-p))
|
||||||
(cl-return-from 'exwm-layout-unset-fullscreen))
|
(cl-return-from 'exwm-layout-unset-fullscreen))
|
||||||
(with-current-buffer (if id (exwm--id->buffer id) (window-buffer))
|
(with-current-buffer (if id (exwm--id->buffer id) (window-buffer))
|
||||||
|
(setq exwm--ewmh-state
|
||||||
|
(delq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
|
||||||
(if exwm--floating-frame
|
(if exwm--floating-frame
|
||||||
(exwm-layout--show exwm--id (frame-root-window exwm--floating-frame))
|
(exwm-layout--show exwm--id (frame-root-window exwm--floating-frame))
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
|
@ -176,8 +192,6 @@
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
(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)
|
||||||
(setq exwm--ewmh-state
|
|
||||||
(delq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
|
|
||||||
(call-interactively #'exwm-input-grab-keyboard)))
|
(call-interactively #'exwm-input-grab-keyboard)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
@ -188,7 +202,7 @@
|
||||||
(cl-return-from 'exwm-layout-toggle-fullscreen))
|
(cl-return-from 'exwm-layout-toggle-fullscreen))
|
||||||
(when id
|
(when id
|
||||||
(with-current-buffer (exwm--id->buffer id)
|
(with-current-buffer (exwm--id->buffer id)
|
||||||
(if (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)
|
(if (exwm-layout--fullscreen-p)
|
||||||
(exwm-reset)
|
(exwm-reset)
|
||||||
(exwm-layout-set-fullscreen id)))))
|
(exwm-layout-set-fullscreen id)))))
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ You can still make the X windows floating afterwards."
|
||||||
(declare-function exwm-floating--unset-floating "exwm-floating.el" (id))
|
(declare-function exwm-floating--unset-floating "exwm-floating.el" (id))
|
||||||
(declare-function exwm-input-grab-keyboard "exwm-input.el")
|
(declare-function exwm-input-grab-keyboard "exwm-input.el")
|
||||||
(declare-function exwm-input-set-local-simulation-keys "exwm-input.el")
|
(declare-function exwm-input-set-local-simulation-keys "exwm-input.el")
|
||||||
|
(declare-function exwm-layout--fullscreen-p "exwm-layout.el" ())
|
||||||
(declare-function exwm-layout--iconic-state-p "exwm-layout.el" (&optional id))
|
(declare-function exwm-layout--iconic-state-p "exwm-layout.el" (&optional id))
|
||||||
(declare-function exwm-workspace--count "exwm-workspace.el" ())
|
(declare-function exwm-workspace--count "exwm-workspace.el" ())
|
||||||
(declare-function exwm-workspace--position "exwm-workspace.el" (frame))
|
(declare-function exwm-workspace--position "exwm-workspace.el" (frame))
|
||||||
|
@ -318,7 +319,7 @@ You can still make the X windows floating afterwards."
|
||||||
(exwm-manage--update-ewmh-state id)
|
(exwm-manage--update-ewmh-state id)
|
||||||
(with-current-buffer (exwm--id->buffer id)
|
(with-current-buffer (exwm--id->buffer id)
|
||||||
(when (or (plist-get exwm--configurations 'fullscreen)
|
(when (or (plist-get exwm--configurations 'fullscreen)
|
||||||
(memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
|
(exwm-layout--fullscreen-p))
|
||||||
(setq exwm--ewmh-state (delq xcb:Atom:_NET_WM_STATE_FULLSCREEN
|
(setq exwm--ewmh-state (delq xcb:Atom:_NET_WM_STATE_FULLSCREEN
|
||||||
exwm--ewmh-state))
|
exwm--ewmh-state))
|
||||||
(exwm-layout-set-fullscreen id))
|
(exwm-layout-set-fullscreen id))
|
||||||
|
@ -533,7 +534,7 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
|
||||||
border-width sibling stack-mode)
|
border-width sibling stack-mode)
|
||||||
(if (and (setq buffer (exwm--id->buffer window))
|
(if (and (setq buffer (exwm--id->buffer window))
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(or (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)
|
(or (exwm-layout--fullscreen-p)
|
||||||
;; Make sure it's a floating X window wanting to resize
|
;; Make sure it's a floating X window wanting to resize
|
||||||
;; itself.
|
;; itself.
|
||||||
(or (not exwm--floating-frame)
|
(or (not exwm--floating-frame)
|
||||||
|
@ -559,7 +560,7 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
|
||||||
;; Send client message for managed windows
|
;; Send client message for managed windows
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(setq edges
|
(setq edges
|
||||||
(if (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)
|
(if (exwm-layout--fullscreen-p)
|
||||||
(with-slots (x y width height)
|
(with-slots (x y width height)
|
||||||
(exwm-workspace--get-geometry exwm--frame)
|
(exwm-workspace--get-geometry exwm--frame)
|
||||||
(list x y width height))
|
(list x y width height))
|
||||||
|
|
|
@ -128,6 +128,7 @@ Please manually run the hook `exwm-workspace-list-change-hook' afterwards.")
|
||||||
(defvar exwm-manage--desktop)
|
(defvar exwm-manage--desktop)
|
||||||
(declare-function exwm--exit "exwm.el")
|
(declare-function exwm--exit "exwm.el")
|
||||||
(declare-function exwm-input--on-buffer-list-update "exwm-input.el" ())
|
(declare-function exwm-input--on-buffer-list-update "exwm-input.el" ())
|
||||||
|
(declare-function exwm-layout--fullscreen-p "exwm-layout.el" ())
|
||||||
(declare-function exwm-layout--hide "exwm-layout.el" (id))
|
(declare-function exwm-layout--hide "exwm-layout.el" (id))
|
||||||
(declare-function exwm-layout--other-buffer-predicate "exwm-layout.el"
|
(declare-function exwm-layout--other-buffer-predicate "exwm-layout.el"
|
||||||
(buffer))
|
(buffer))
|
||||||
|
@ -504,7 +505,7 @@ for internal use only."
|
||||||
((null current-prefix-arg)
|
((null current-prefix-arg)
|
||||||
(unless (and (eq major-mode 'exwm-mode)
|
(unless (and (eq major-mode 'exwm-mode)
|
||||||
;; The prompt is invisible in fullscreen mode.
|
;; The prompt is invisible in fullscreen mode.
|
||||||
(memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
|
(exwm-layout--fullscreen-p))
|
||||||
(let ((exwm-workspace--prompt-add-allowed t)
|
(let ((exwm-workspace--prompt-add-allowed t)
|
||||||
(exwm-workspace--prompt-delete-allowed t))
|
(exwm-workspace--prompt-delete-allowed t))
|
||||||
(exwm-workspace--prompt-for-workspace "Switch to [+/-]: "))))
|
(exwm-workspace--prompt-for-workspace "Switch to [+/-]: "))))
|
||||||
|
@ -631,7 +632,7 @@ Passing a workspace frame as the first option is for internal use only."
|
||||||
(interactive
|
(interactive
|
||||||
(unless (and (eq major-mode 'exwm-mode)
|
(unless (and (eq major-mode 'exwm-mode)
|
||||||
;; The prompt is invisible in fullscreen mode.
|
;; The prompt is invisible in fullscreen mode.
|
||||||
(memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
|
(exwm-layout--fullscreen-p))
|
||||||
(let (w1 w2)
|
(let (w1 w2)
|
||||||
(let ((exwm-workspace--prompt-add-allowed t)
|
(let ((exwm-workspace--prompt-add-allowed t)
|
||||||
(exwm-workspace--prompt-delete-allowed t))
|
(exwm-workspace--prompt-delete-allowed t))
|
||||||
|
@ -671,7 +672,7 @@ before it."
|
||||||
((null current-prefix-arg)
|
((null current-prefix-arg)
|
||||||
(unless (and (eq major-mode 'exwm-mode)
|
(unless (and (eq major-mode 'exwm-mode)
|
||||||
;; The prompt is invisible in fullscreen mode.
|
;; The prompt is invisible in fullscreen mode.
|
||||||
(memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
|
(exwm-layout--fullscreen-p))
|
||||||
(list exwm-workspace--current
|
(list exwm-workspace--current
|
||||||
(exwm-workspace--position
|
(exwm-workspace--position
|
||||||
(exwm-workspace--prompt-for-workspace "Move workspace to: ")))))
|
(exwm-workspace--prompt-for-workspace "Move workspace to: ")))))
|
||||||
|
|
14
exwm.el
14
exwm.el
|
@ -110,7 +110,7 @@
|
||||||
(interactive)
|
(interactive)
|
||||||
(with-current-buffer (window-buffer)
|
(with-current-buffer (window-buffer)
|
||||||
(when (eq major-mode 'exwm-mode)
|
(when (eq major-mode 'exwm-mode)
|
||||||
(when (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)
|
(when (exwm-layout--fullscreen-p)
|
||||||
(exwm-layout-unset-fullscreen))
|
(exwm-layout-unset-fullscreen))
|
||||||
;; Force refresh
|
;; Force refresh
|
||||||
(exwm-layout--refresh)
|
(exwm-layout--refresh)
|
||||||
|
@ -484,8 +484,7 @@
|
||||||
exwm--connection
|
exwm--connection
|
||||||
(make-instance 'xcb:ewmh:set-_NET_WM_STATE
|
(make-instance 'xcb:ewmh:set-_NET_WM_STATE
|
||||||
:window id
|
:window id
|
||||||
:data (vector
|
:data (vector xcb:Atom:_NET_WM_STATE_FULLSCREEN)))
|
||||||
xcb:Atom:_NET_WM_STATE_FULLSCREEN)))
|
|
||||||
(xcb:flush exwm--connection))
|
(xcb:flush exwm--connection))
|
||||||
(when buffer ;ensure it's managed
|
(when buffer ;ensure it's managed
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
|
@ -493,17 +492,14 @@
|
||||||
(when (or (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN props)
|
(when (or (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN props)
|
||||||
(memq xcb:Atom:_NET_WM_STATE_ABOVE props))
|
(memq xcb:Atom:_NET_WM_STATE_ABOVE props))
|
||||||
(cond ((= action xcb:ewmh:_NET_WM_STATE_ADD)
|
(cond ((= action xcb:ewmh:_NET_WM_STATE_ADD)
|
||||||
(unless (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN
|
(unless (exwm-layout--fullscreen-p)
|
||||||
exwm--ewmh-state)
|
|
||||||
(exwm-layout-set-fullscreen id))
|
(exwm-layout-set-fullscreen id))
|
||||||
(push xcb:Atom:_NET_WM_STATE_FULLSCREEN props-new))
|
(push xcb:Atom:_NET_WM_STATE_FULLSCREEN props-new))
|
||||||
((= action xcb:ewmh:_NET_WM_STATE_REMOVE)
|
((= action xcb:ewmh:_NET_WM_STATE_REMOVE)
|
||||||
(when (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN
|
(when (exwm-layout--fullscreen-p)
|
||||||
exwm--ewmh-state)
|
|
||||||
(exwm-layout-unset-fullscreen id)))
|
(exwm-layout-unset-fullscreen id)))
|
||||||
((= action xcb:ewmh:_NET_WM_STATE_TOGGLE)
|
((= action xcb:ewmh:_NET_WM_STATE_TOGGLE)
|
||||||
(if (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN
|
(if (exwm-layout--fullscreen-p)
|
||||||
exwm--ewmh-state)
|
|
||||||
(exwm-layout-unset-fullscreen id)
|
(exwm-layout-unset-fullscreen id)
|
||||||
(exwm-layout-set-fullscreen id)
|
(exwm-layout-set-fullscreen id)
|
||||||
(push xcb:Atom:_NET_WM_STATE_FULLSCREEN props-new)))))
|
(push xcb:Atom:_NET_WM_STATE_FULLSCREEN props-new)))))
|
||||||
|
|
Loading…
Reference in a new issue