about summary refs log tree commit diff
path: root/exwm-systemtray.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2017-10-08T16·29+0800
committerChris Feng <chris.w.feng@gmail.com>2017-10-08T16·29+0800
commit3edf2e8880aff11803f4d4889914e05c3543e6e7 (patch)
tree8c875797956d429494be60e42883f94ded5daa31 /exwm-systemtray.el
parent75eb43e1e0a0e2efb7107ebed565abd40fdfd0c4 (diff)
Fix systemtray applications crash when restarting
* exwm-systemtray.el (exwm-systemtray--exit): Reparent out the tray
embedder to protect tray icons.
Diffstat (limited to 'exwm-systemtray.el')
-rw-r--r--exwm-systemtray.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/exwm-systemtray.el b/exwm-systemtray.el
index 48bd8eacb10a..4fc7ded33161 100644
--- a/exwm-systemtray.el
+++ b/exwm-systemtray.el
@@ -480,6 +480,18 @@ You shall use the default value if using auto-hide minibuffer.")
 (defun exwm-systemtray--exit ()
   "Exit the systemtray module."
   (when exwm-systemtray--connection
+    ;; Hide & reparent out the embedder before disconnection to prevent
+    ;; embedded icons from being reparented to an Emacs frame (which is the
+    ;; parent of the embedder).
+    (xcb:+request exwm-systemtray--connection
+        (make-instance 'xcb:UnmapWindow
+                       :window exwm-systemtray--embedder))
+    (xcb:+request exwm-systemtray--connection
+        (make-instance 'xcb:ReparentWindow
+                       :window exwm-systemtray--embedder
+                       :parent exwm--root
+                       :x 0
+                       :y 0))
     (xcb:disconnect exwm-systemtray--connection)
     (setq exwm-systemtray--connection nil
           exwm-systemtray--list nil