Add RandR support for docks and reuse workareas

* exwm-workspace (exwm-workspace--update-struts): Add RandR support for
docks.

* exwm-workspace (exwm-workspace--workareas): New variable for storing
workareas.
(exwm-workspace--update-workareas): Update workareas and set
_NET_WORKAREA (replaces `exwm-workspace--set-workareas').
(exwm-workspace--set-fullscreen): Reuse workareas for
resizing and drop optional arguments.
(exwm-workspace--resize-minibuffer-frame)
(exwm-workspace--on-ConfigureNotify): Reuse workareas for
resizing/reposition the (optional) dedicated minibuffer frame.

* exwm-layout.el (exwm-layout-set-fullscreen): Do not use
`exwm-workspace--set-fullscreen' here.

* exwm-manage.el (exwm-manage--unmanage-window):
* exwm-randr.el (exwm-randr--refresh):
* exwm.el (exwm--update-struts-legacy, exwm--update-struts-partial):
Update workareas before resizing workspaces.

* exwm.el (exwm--update-struts-legacy, exwm--update-struts-partial):
Remove the corresponding record on receiving invalid struts.

* exwm-workspace.el (exwm-workspace--get-geometry): New utility
function for retrieving workspace geometry.
This commit is contained in:
Chris Feng 2016-07-16 14:34:57 +08:00
parent 7f12d9fc7a
commit 4ac71a7ddc
5 changed files with 170 additions and 148 deletions

View file

@ -58,15 +58,13 @@
(defvar exwm-workspace-number)
(defvar exwm-workspace--list)
(declare-function exwm-workspace--set-fullscreen "exwm-workspace.el"
(frame &optional no-struts container-only))
(declare-function exwm-workspace--set-workareas "exwm-workspace.el"
(&optional workareas))
(declare-function exwm-workspace--update-workareas "exwm-workspace.el" ())
(declare-function exwm-workspace--set-fullscreen "exwm-workspace.el" (frame))
(declare-function exwm-workspace--set-desktop-geometry "exwm-workspace.el" ())
(defun exwm-randr--refresh ()
"Refresh workspaces according to the updated RandR info."
(let (output-name geometry output-plist default-geometry workareas)
(let (output-name geometry output-plist default-geometry)
;; Query all outputs
(with-slots (config-timestamp outputs)
(xcb:+request-unchecked+reply exwm--connection
@ -96,7 +94,9 @@
(setq default-geometry geometry)))))))
(exwm--log "(randr) outputs: %s" output-plist)
(when output-plist
(setq exwm-workspace--fullscreen-frame-count 0)
(when exwm-workspace--fullscreen-frame-count
;; Not all workspaces are fullscreen; reset this counter.
(setq exwm-workspace--fullscreen-frame-count 0))
(dotimes (i exwm-workspace-number)
(let* ((output (plist-get exwm-randr-workspace-output-plist i))
(geometry (lax-plist-get output-plist output))
@ -105,14 +105,14 @@
(setq geometry default-geometry
output nil))
(set-frame-parameter frame 'exwm-randr-output output)
(set-frame-parameter frame 'exwm-geometry geometry)
(exwm-workspace--set-fullscreen frame)
(with-slots (x y width height) geometry
(setq workareas (nconc workareas (list x y width height))))))
(set-frame-parameter frame 'exwm-geometry geometry)))
;; Update workareas and set _NET_WORKAREA.
(exwm-workspace--update-workareas)
;; Resize workspace.
(dolist (f exwm-workspace--list)
(exwm-workspace--set-fullscreen f))
;; Set _NET_DESKTOP_GEOMETRY.
(exwm-workspace--set-desktop-geometry)
;; Set _NET_WORKAREA.
(exwm-workspace--set-workareas (vconcat workareas))
(xcb:flush exwm--connection)
(run-hooks 'exwm-randr-refresh-hook))))