diff options
author | Chris Feng <chris.w.feng@gmail.com> | 2018-03-04T04·23+0800 |
---|---|---|
committer | Chris Feng <chris.w.feng@gmail.com> | 2018-03-04T04·29+0800 |
commit | 46fe764634ff4fa0eff7ea87c3b96209a05c89be (patch) | |
tree | 3cd4e040f3b3b463638a6cdefcf0a1ca3496369e /exwm-layout.el | |
parent | 277377c718429555f75a88a85f336d80f3716dce (diff) |
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.
Diffstat (limited to 'exwm-layout.el')
-rw-r--r-- | exwm-layout.el | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/exwm-layout.el b/exwm-layout.el index 5a01f900323d..998556bc896f 100644 --- a/exwm-layout.el +++ b/exwm-layout.el @@ -69,6 +69,10 @@ (buffer-local-value 'exwm-state (exwm--id->buffer id)) 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) "Show window ID exactly fit in the Emacs window WINDOW." (exwm--log "Show #x%x in %s" id window) @@ -92,6 +96,16 @@ (exwm--set-geometry (frame-parameter exwm--floating-frame 'exwm-container) 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) (xcb:+request exwm--connection (make-instance 'xcb:MapWindow :window id)) (exwm-layout--set-state id xcb:icccm:WM_STATE:NormalState))) @@ -131,7 +145,7 @@ "Make window ID fullscreen." (interactive) (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)) (with-current-buffer (if id (exwm--id->buffer id) (window-buffer)) ;; Expand the X window to fill the whole screen. @@ -158,9 +172,11 @@ "Restore window from fullscreen state." (interactive) (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)) (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 (exwm-layout--show exwm--id (frame-root-window exwm--floating-frame)) (xcb:+request exwm--connection @@ -176,8 +192,6 @@ (xcb:+request exwm--connection (make-instance 'xcb:ewmh:set-_NET_WM_STATE :window exwm--id :data [])) (xcb:flush exwm--connection) - (setq exwm--ewmh-state - (delq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)) (call-interactively #'exwm-input-grab-keyboard))) ;;;###autoload @@ -188,7 +202,7 @@ (cl-return-from 'exwm-layout-toggle-fullscreen)) (when 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-layout-set-fullscreen id))))) |