branch: externals/exwm
commit 5373c1df1a8432f6a54e8ded8c9a145842c067e2
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

    Add support for xcb:Atom:_NET_CLIENT_LIST_STACKING etc
    
    The _NET_CLIENT_LIST_STACKING EWMH property is essential for e.g. the 
tabbar of
    chromium to work correctly.
    
    * exwm-input.el: Remove invalid TODO item.
    * exwm.el (exwm--init-icccm-ewmh): Add xcb:Atom:_NET_CLIENT_LIST and
      xcb:Atom:_NET_CLIENT_LIST_STACKING to _NET_SUPPORTED.
    * exwm-layout.el (exwm-layout--refresh): Update _NET_CLIENT_LIST_STACKING.
    * exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window):
      Update _NET_CLIENT_LIST.
---
 exwm-input.el  |    1 -
 exwm-layout.el |   15 ++++++++++++++-
 exwm-manage.el |    9 +++++++++
 exwm.el        |    2 ++
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 69d2aff..afa619b 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -32,7 +32,6 @@
 ;; + Simulation keys to mimic Emacs key bindings for text edit (redo, select,
 ;;   cancel, clear, etc). Some of them are not present on common keyboard
 ;;   (keycode = 0). May need to use XKB extension.
-;; + Investigate DnD support (e.g. drag a chromium tab to another window).
 
 ;;; Code:
 
diff --git a/exwm-layout.el b/exwm-layout.el
index a14651a..ae1f48d 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -239,7 +239,20 @@
         (with-current-buffer (window-buffer window)
           (when (and (eq major-mode 'exwm-mode)
                      (or exwm--floating-frame (not (eq frame exwm--frame))))
-            (set-window-buffer window placeholder)))))))
+            (set-window-buffer window placeholder))))
+      ;; Update _NET_CLIENT_LIST_STACKING
+      (xcb:+request exwm--connection
+          (make-instance 'xcb:ewmh:set-_NET_CLIENT_LIST_STACKING
+                         :window exwm--root
+                         :data (vconcat
+                                (delq nil
+                                      (mapcar
+                                       (lambda (buffer)
+                                         (with-current-buffer buffer
+                                           (when (eq major-mode 'exwm-mode)
+                                             exwm--id)))
+                                       (buffer-list))))))
+      (xcb:flush exwm--connection))))
 
 (defun exwm-layout--on-minibuffer-setup ()
   "Refresh layout when minibuffer grows."
diff --git a/exwm-manage.el b/exwm-manage.el
index a8d0e59..2636c01 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -128,6 +128,10 @@ corresponding buffer.")
                          :cursor xcb:Cursor:None
                          :button xcb:ButtonIndex:Any
                          :modifiers xcb:ModMask:Any))
+      (xcb:+request exwm--connection    ;update _NET_CLIENT_LIST
+          (make-instance 'xcb:ewmh:set-_NET_CLIENT_LIST
+                         :window exwm--root
+                         :data (vconcat (mapcar #'car exwm--id-buffer-alist))))
       (xcb:flush exwm--connection)
       (exwm--update-title id)
       (exwm--update-transient-for id)
@@ -150,6 +154,11 @@ corresponding buffer.")
   (let ((buffer (exwm--id->buffer id)))
     (exwm--log "Unmanage #x%x (buffer: %s)" id buffer)
     (setq exwm--id-buffer-alist (assq-delete-all id exwm--id-buffer-alist))
+    (xcb:+request exwm--connection      ;update _NET_CLIENT_LIST
+        (make-instance 'xcb:ewmh:set-_NET_CLIENT_LIST
+                       :window exwm--root
+                       :data (vconcat (mapcar #'car exwm--id-buffer-alist))))
+    (xcb:flush exwm--connection)
     (when (buffer-live-p buffer)
       (with-current-buffer buffer
         (exwm-workspace--update-switch-history)
diff --git a/exwm.el b/exwm.el
index 84fbc15..bf45e40 100644
--- a/exwm.el
+++ b/exwm.el
@@ -417,6 +417,8 @@
       (make-instance 'xcb:ewmh:set-_NET_SUPPORTED
                      :window exwm--root
                      :data (vector xcb:Atom:_NET_SUPPORTED
+                                   xcb:Atom:_NET_CLIENT_LIST
+                                   xcb:Atom:_NET_CLIENT_LIST_STACKING
                                    xcb:Atom:_NET_NUMBER_OF_DESKTOPS
                                    xcb:Atom:_NET_DESKTOP_VIEWPORT
                                    xcb:Atom:_NET_CURRENT_DESKTOP

Reply via email to