about summary refs log tree commit diff
path: root/exwm-systemtray.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-08-07T05·34+0800
committerChris Feng <chris.w.feng@gmail.com>2016-08-07T05·34+0800
commit06c1b0485a1815d13ded7bd717adf5d9735be3df (patch)
tree64f8ca265add9eaea49b3c964b17ea38b3801dec /exwm-systemtray.el
parentdcec998bb446320c6029522a089800cbc6b73b55 (diff)
Set background pixmap for system tray embedder
* exwm-systemtray.el (exwm-systemtray--init): Make embedder use the same
depth and pixmap of the parent; the parent is always a Emacs frame.
Diffstat (limited to 'exwm-systemtray.el')
-rw-r--r--exwm-systemtray.el43
1 files changed, 27 insertions, 16 deletions
diff --git a/exwm-systemtray.el b/exwm-systemtray.el
index 25f5fa584c4a..e978f64e15e3 100644
--- a/exwm-systemtray.el
+++ b/exwm-systemtray.el
@@ -370,27 +370,38 @@ You shall use the default value if using auto-hide minibuffer.")
                        :data xcb:systemtray:ORIENTATION:HORZ)))
   ;; Create the embedder.
   (let ((id (xcb:generate-id exwm-systemtray--connection))
-        parent y)
+        frame parent depth y)
     (setq exwm-systemtray--embedder id)
-    (xcb:+request exwm-systemtray--connection
-        (make-instance 'xcb:CreateWindow
-                       :depth 0 :wid id :parent exwm--root
-                       :x 0 :y 0 :width 1 :height exwm-systemtray-height
-                       :border-width 0 :class xcb:WindowClass:CopyFromParent
-                       :visual 0 :value-mask xcb:CW:EventMask
-                       :event-mask xcb:EventMask:SubstructureNotify))
     (if (exwm-workspace--minibuffer-own-frame-p)
-        (setq parent (frame-parameter exwm-workspace--minibuffer
-                                      'exwm-container)
-              ;; Vertically centered.
-              y (/ (- (line-pixel-height) exwm-systemtray-height) 2))
-      (setq parent (string-to-number (frame-parameter exwm-workspace--current
-                                                      'window-id))
+        (setq frame exwm-workspace--minibuffer
+              y (if (>= (line-pixel-height) exwm-systemtray-height)
+                    ;; Bottom aligned.
+                    (- (line-pixel-height) exwm-systemtray-height)
+                  ;; Vertically centered.
+                  (/ (- (line-pixel-height) exwm-systemtray-height) 2)))
+      (setq frame exwm-workspace--current
             ;; Bottom aligned.
             y (- (exwm-workspace--current-height) exwm-systemtray-height)))
+    (setq parent (string-to-number (frame-parameter frame 'window-id))
+          depth (slot-value (xcb:+request-unchecked+reply exwm--connection
+                                (make-instance 'xcb:GetGeometry
+                                               :drawable parent))
+                            'depth))
     (xcb:+request exwm-systemtray--connection
-        (make-instance 'xcb:ReparentWindow
-                       :window id :parent parent :x 0 :y y))
+        (make-instance 'xcb:CreateWindow
+                       :depth depth
+                       :wid id
+                       :parent parent
+                       :x 0
+                       :y y
+                       :width 1
+                       :height exwm-systemtray-height
+                       :border-width 0
+                       :class xcb:WindowClass:CopyFromParent
+                       :visual 0
+                       :value-mask (logior xcb:CW:BackPixmap xcb:CW:EventMask)
+                       :background-pixmap xcb:BackPixmap:ParentRelative
+                       :event-mask xcb:EventMask:SubstructureNotify))
     ;; Set _NET_WM_NAME.
     (xcb:+request exwm-systemtray--connection
         (make-instance 'xcb:ewmh:set-_NET_WM_NAME