about summary refs log tree commit diff
path: root/exwm.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-07-15T12·04+0800
committerChris Feng <chris.w.feng@gmail.com>2016-07-15T12·04+0800
commit7f12d9fc7a88369a479ed2f0489ff3b10b347d13 (patch)
tree9e2da5e00adeaa8117dd8e832a521fc78440e4c0 /exwm.el
parent0b8a373e4fd092b527b34070b6556be35983062c (diff)
Add multi-dock support and fix fullscreen issues with dock
* exwm.el (exwm--update-strut-legacy, exwm--update-strut-partial)
(exwm--update-strut): Rename (strut => struts).

* exwm-manage.el (exwm-manage--manage-window): Listen for
UnmapNotify/DestroyNotify events of docks to stop tracking them.
(exwm-manage--unmanage-window): Remove dock from tracking list when
it's unmapped/destroyed.
* exwm-workspace.el (exwm-workspace--id-struts-alist): New variable
for tracking docks.
(exwm-workspace--struts): Now it stores merged struts.
(exwm-workspace--update-struts): New function for doing the 'merge'.
* exwm.el (exwm--update-struts-legacy, exwm--update-struts-partial):
Now update struts for multiple docks.

* exwm-layout.el (exwm-layout-set-fullscreen)
(exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--unmanage-window):
Fix fullscreen mode with dock.
* exwm-workspace.el (exwm-workspace--set-fullscreen): Add optional
arguments for ignoring struts / resizing container only.
(exwm-workspace-switch): Restack workspace/docks appropriately.
Diffstat (limited to 'exwm.el')
-rw-r--r--exwm.el52
1 files changed, 28 insertions, 24 deletions
diff --git a/exwm.el b/exwm.el
index 3d7edcfeac16..59f43136f786 100644
--- a/exwm.el
+++ b/exwm.el
@@ -227,45 +227,49 @@
         (when reply                     ;nil when destroyed
           (setq exwm--protocols (append (slot-value reply 'value) nil)))))))
 
-(defun exwm--update-strut-legacy (id)
+(defun exwm--update-struts-legacy (id)
   "Update _NET_WM_STRUT."
-  (unless exwm-workspace--strut-is-partial
-    (let ((reply (xcb:+request-unchecked+reply exwm--connection
-                     (make-instance 'xcb:ewmh:get-_NET_WM_STRUT
-                                    :window id))))
-      (setq exwm-workspace--strut (when reply (slot-value reply 'value)))
+  (let ((pair (assq id exwm-workspace--id-struts-alist))
+        reply struts)
+    (unless (and pair (< 4 (length (cdr pair))))
+      (setq reply (xcb:+request-unchecked+reply exwm--connection
+                      (make-instance 'xcb:ewmh:get-_NET_WM_STRUT
+                                     :window id)))
+      (when reply
+        (setq struts (slot-value reply 'value))
+        (if pair
+            (setcdr pair struts)
+          (push (cons id struts) exwm-workspace--id-struts-alist))
+        (exwm-workspace--update-struts))
       ;; Update workspaces.
       (dolist (f exwm-workspace--list)
         (exwm-workspace--set-fullscreen f))
-      ;; Resize the minibuffer frame.
-      (when (exwm-workspace--minibuffer-own-frame-p)
-        (exwm-workspace--resize-minibuffer-frame))
       ;; Update _NET_WORKAREA.
       (exwm-workspace--set-workareas))))
 
-(defun exwm--update-strut-partial (id)
+(defun exwm--update-struts-partial (id)
   "Update _NET_WM_STRUT_PARTIAL."
   (let ((reply (xcb:+request-unchecked+reply exwm--connection
                    (make-instance 'xcb:ewmh:get-_NET_WM_STRUT_PARTIAL
-                                  :window id))))
-    (setq exwm-workspace--strut (when reply (slot-value reply 'value)))
-    (if (not exwm-workspace--strut)
-        (setq exwm-workspace--strut-is-partial nil)
-      (setq exwm-workspace--strut (substring exwm-workspace--strut 0 4))
-      (setq exwm-workspace--strut-is-partial t))
+                                  :window id)))
+        struts pair)
+    (when reply
+      (setq struts (slot-value reply 'value)
+            pair (assq id exwm-workspace--id-struts-alist))
+      (if pair
+          (setcdr pair struts)
+        (push (cons id struts) exwm-workspace--id-struts-alist))
+      (exwm-workspace--update-struts))
     ;; Update workspaces.
     (dolist (f exwm-workspace--list)
       (exwm-workspace--set-fullscreen f))
-    ;; Resize the minibuffer frame.
-    (when (exwm-workspace--minibuffer-own-frame-p)
-      (exwm-workspace--resize-minibuffer-frame))
     ;; Update _NET_WORKAREA.
     (exwm-workspace--set-workareas)))
 
-(defun exwm--update-strut (id)
+(defun exwm--update-struts (id)
   "Update _NET_WM_STRUT_PARTIAL or _NET_WM_STRUT."
-  (exwm--update-strut-partial id)
-  (exwm--update-strut-legacy id))
+  (exwm--update-struts-partial id)
+  (exwm--update-struts-legacy id))
 
 (defun exwm--on-PropertyNotify (data _synthetic)
   "Handle PropertyNotify event."
@@ -279,9 +283,9 @@
     (if (not (buffer-live-p buffer))
         ;; Properties of unmanaged X windows.
         (cond ((= atom xcb:Atom:_NET_WM_STRUT)
-               (exwm--update-strut-legacy id))
+               (exwm--update-struts-legacy id))
               ((= atom xcb:Atom:_NET_WM_STRUT_PARTIAL)
-               (exwm--update-strut-partial id)))
+               (exwm--update-struts-partial id)))
       (with-current-buffer buffer
         (cond ((= atom xcb:Atom:_NET_WM_WINDOW_TYPE)
                (exwm--update-window-type id t))