Prevent Emacs frames from restacking themselves

Putting Emacs frames (workspace frames, floating frames) into dedicated
containers greatly simplifies the stacking order management and totally
fixes relevant issues.

* exwm-floating.el (exwm-floating--set-floating): Create floating frame
container.  Remove redundant stacking order modification code.
(exwm-floating--unset-floating): Destroy the floating frame container.
No need to reparent the X window container.
(exwm-floating--do-moveresize): Resize the floating frame container.
* exwm-input.el (exwm-input--update-focus): No need to restack frames.
* exwm-layout.el (exwm-layout--show, exwm-layout--set-frame-fullscreen)
(exwm-layout-enlarge-window): Resize the floating frame container.
* exwm-manage.el (exwm-manage--on-ConfigureRequest): Re-enable stacking
order modification on ConfigureRequest.

* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): Reparent out all
frames on exit.  No need to remove selected events or created resources.
(exwm-workspace--init): Create workspace frame containers.

* exwm-layout.el (exwm-layout-set-fullscreen):
* exwm-manage.el (exwm-manage--unmanage-window): Remove a redundant call to
`xcb:flush'.

* exwm-manage.el (exwm-manage--unmanage-window): Force unmap the X window.
Unmap the floating frame before reparent it.
This commit is contained in:
Chris Feng 2016-02-20 21:52:07 +08:00
parent 1c79e1c238
commit e3d33a4aad
5 changed files with 192 additions and 121 deletions

View file

@ -113,8 +113,8 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
(exwm-workspace-switch exwm-workspace-current-index t))
(exwm--log "Set focus on #x%x" exwm--id)
(exwm-input--set-focus exwm--id)
;; Adjust stacking orders
(when exwm--floating-frame
;; Adjust stacking orders of the floating container.
(if (exwm-workspace--minibuffer-own-frame-p)
;; Put this floating X window just below the minibuffer.
(xcb:+request exwm--connection
@ -132,16 +132,8 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
(make-instance 'xcb:ConfigureWindow
:window exwm--container
:value-mask xcb:ConfigWindow:StackMode
:stack-mode xcb:StackMode:Above))))
;; Make sure Emacs frames are at bottom.
(xcb:+request exwm--connection
(make-instance 'xcb:ConfigureWindow
:window (frame-parameter
(or exwm--floating-frame exwm--frame)
'exwm-outer-id)
:value-mask xcb:ConfigWindow:StackMode
:stack-mode xcb:StackMode:BottomIf))
(xcb:flush exwm--connection))
:stack-mode xcb:StackMode:Above)))
(xcb:flush exwm--connection)))
(when (eq (selected-window) exwm-input--focus-window)
(exwm--log "Focus on %s" exwm-input--focus-window)
(select-frame-set-input-focus (window-frame exwm-input--focus-window)