about summary refs log tree commit diff
path: root/exwm-randr.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-07-16T06·34+0800
committerChris Feng <chris.w.feng@gmail.com>2016-07-16T06·34+0800
commit4ac71a7ddc78d1485a7fca7a8dbf4c4f6b4016f2 (patch)
treee3b9ff8f06ef87f3eb81314fd765df2c04c9619d /exwm-randr.el
parent7f12d9fc7a88369a479ed2f0489ff3b10b347d13 (diff)
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.
Diffstat (limited to 'exwm-randr.el')
-rw-r--r--exwm-randr.el24
1 files changed, 12 insertions, 12 deletions
diff --git a/exwm-randr.el b/exwm-randr.el
index 9f6be782f9a4..85daff245d19 100644
--- a/exwm-randr.el
+++ b/exwm-randr.el
@@ -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))))