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.
This commit is contained in:
Chris Feng 2016-08-07 13:34:50 +08:00
parent dcec998bb4
commit 06c1b0485a

View file

@ -370,27 +370,38 @@ You shall use the default value if using auto-hide minibuffer.")
:data xcb:systemtray:ORIENTATION:HORZ))) :data xcb:systemtray:ORIENTATION:HORZ)))
;; Create the embedder. ;; Create the embedder.
(let ((id (xcb:generate-id exwm-systemtray--connection)) (let ((id (xcb:generate-id exwm-systemtray--connection))
parent y) frame parent depth y)
(setq exwm-systemtray--embedder id) (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) (if (exwm-workspace--minibuffer-own-frame-p)
(setq parent (frame-parameter exwm-workspace--minibuffer (setq frame exwm-workspace--minibuffer
'exwm-container) y (if (>= (line-pixel-height) exwm-systemtray-height)
;; Vertically centered. ;; Bottom aligned.
y (/ (- (line-pixel-height) exwm-systemtray-height) 2)) (- (line-pixel-height) exwm-systemtray-height)
(setq parent (string-to-number (frame-parameter exwm-workspace--current ;; Vertically centered.
'window-id)) (/ (- (line-pixel-height) exwm-systemtray-height) 2)))
(setq frame exwm-workspace--current
;; Bottom aligned. ;; Bottom aligned.
y (- (exwm-workspace--current-height) exwm-systemtray-height))) 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 (xcb:+request exwm-systemtray--connection
(make-instance 'xcb:ReparentWindow (make-instance 'xcb:CreateWindow
:window id :parent parent :x 0 :y y)) :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. ;; Set _NET_WM_NAME.
(xcb:+request exwm-systemtray--connection (xcb:+request exwm-systemtray--connection
(make-instance 'xcb:ewmh:set-_NET_WM_NAME (make-instance 'xcb:ewmh:set-_NET_WM_NAME