about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdrián Medraño Calvo <adrian@medranocalvo.com>2018-08-13T12·00+0000
committerChris Feng <chris.w.feng@gmail.com>2018-08-19T00·00+0000
commit29f2289a750c9cf8f0d5cd968d306ee953a7bc0d (patch)
treecfeaad5f91a84e3de82699d7b3232b38763a6016
parent4d43e3119a2d0cb002d87340cd11c1d372ad126e (diff)
Consistently name helper windows
* exwm.el (exwm--init-icccm-ewmh): Avoid naming the root window.
(exwm--wmsn-acquire): Use the symbol name in the window name.
* exwm-systemtray.el (exwm-systemtray--embedder-window): Rename
`exwm-systemtray--embedder' consistency.
(exwm-systemtray--init):  Use symbol names in the window name.
-rw-r--r--exwm-systemtray.el37
-rw-r--r--exwm.el12
2 files changed, 27 insertions, 22 deletions
diff --git a/exwm-systemtray.el b/exwm-systemtray.el
index ba1e3889347a..d3244ab8d088 100644
--- a/exwm-systemtray.el
+++ b/exwm-systemtray.el
@@ -70,7 +70,7 @@ You shall use the default value if using auto-hide minibuffer."
 
 (defvar exwm-systemtray--connection nil "The X connection.")
 
-(defvar exwm-systemtray--embedder nil "The embedder window.")
+(defvar exwm-systemtray--embedder-window nil "The embedder window.")
 
 (defvar exwm-systemtray--list nil "The icon list.")
 
@@ -112,7 +112,7 @@ You shall use the default value if using auto-hide minibuffer."
       (xcb:+request exwm-systemtray--connection
           (make-instance 'xcb:ReparentWindow
                          :window icon
-                         :parent exwm-systemtray--embedder
+                         :parent exwm-systemtray--embedder-window
                          :x 0
                          ;; Vertically centered.
                          :y (/ (- exwm-systemtray-height height*) 2)))
@@ -162,7 +162,8 @@ You shall use the default value if using auto-hide minibuffer."
                           (make-instance 'xcb:xembed:EMBEDDED-NOTIFY
                                          :window icon
                                          :time xcb:Time:CurrentTime
-                                         :embedder exwm-systemtray--embedder
+                                         :embedder
+                                         exwm-systemtray--embedder-window
                                          :version 0)
                           exwm-systemtray--connection)))
       (push `(,icon . ,(make-instance 'exwm-systemtray--icon
@@ -190,7 +191,8 @@ You shall use the default value if using auto-hide minibuffer."
   "Refresh the system tray."
   ;; Make sure to redraw the embedder.
   (xcb:+request exwm-systemtray--connection
-      (make-instance 'xcb:UnmapWindow :window exwm-systemtray--embedder))
+      (make-instance 'xcb:UnmapWindow
+                     :window exwm-systemtray--embedder-window))
   (let ((x exwm-systemtray-icon-gap)
         map)
     (dolist (pair exwm-systemtray--list)
@@ -207,14 +209,15 @@ You shall use the default value if using auto-hide minibuffer."
                          exwm-workspace-current-index)))
       (xcb:+request exwm-systemtray--connection
           (make-instance 'xcb:ConfigureWindow
-                         :window exwm-systemtray--embedder
+                         :window exwm-systemtray--embedder-window
                          :value-mask (logior xcb:ConfigWindow:X
                                              xcb:ConfigWindow:Width)
                          :x (- (aref workarea 2) x)
                          :width x)))
     (when map
       (xcb:+request exwm-systemtray--connection
-          (make-instance 'xcb:MapWindow :window exwm-systemtray--embedder))))
+          (make-instance 'xcb:MapWindow
+                         :window exwm-systemtray--embedder-window))))
   (xcb:flush exwm-systemtray--connection))
 
 (defun exwm-systemtray--on-DestroyNotify (data _synthetic)
@@ -230,7 +233,7 @@ You shall use the default value if using auto-hide minibuffer."
   (let ((obj (make-instance 'xcb:ReparentNotify)))
     (xcb:unmarshal obj data)
     (with-slots (window parent) obj
-      (when (and (/= parent exwm-systemtray--embedder)
+      (when (and (/= parent exwm-systemtray--embedder-window)
                  (assoc window exwm-systemtray--list))
         (exwm-systemtray--unembed window)))))
 
@@ -325,7 +328,7 @@ You shall use the default value if using auto-hide minibuffer."
   (unless (exwm-workspace--minibuffer-own-frame-p)
     (xcb:+request exwm-systemtray--connection
         (make-instance 'xcb:ReparentWindow
-                       :window exwm-systemtray--embedder
+                       :window exwm-systemtray--embedder-window
                        :parent (string-to-number
                                 (frame-parameter exwm-workspace--current
                                                  'window-id))
@@ -339,7 +342,7 @@ You shall use the default value if using auto-hide minibuffer."
   (unless (exwm-workspace--minibuffer-own-frame-p)
     (xcb:+request exwm-systemtray--connection
         (make-instance 'xcb:ConfigureWindow
-                       :window exwm-systemtray--embedder
+                       :window exwm-systemtray--embedder-window
                        :value-mask xcb:ConfigWindow:Y
                        :y (- (frame-pixel-height exwm-workspace--current)
                              exwm-systemtray-height))))
@@ -353,7 +356,7 @@ You shall use the default value if using auto-hide minibuffer."
   (cl-assert (not exwm-systemtray--connection))
   (cl-assert (not exwm-systemtray--list))
   (cl-assert (not exwm-systemtray--selection-owner-window))
-  (cl-assert (not exwm-systemtray--embedder))
+  (cl-assert (not exwm-systemtray--embedder-window))
   (unless exwm-systemtray-height
     (setq exwm-systemtray-height (max exwm-systemtray--icon-min-size
                                       (line-pixel-height))))
@@ -414,7 +417,8 @@ You shall use the default value if using auto-hide minibuffer."
     ;; Set _NET_WM_NAME.
     (xcb:+request exwm-systemtray--connection
         (make-instance 'xcb:ewmh:set-_NET_WM_NAME
-                       :window id :data "EXWM system tray selection owner"))
+                       :window id
+                       :data "EXWM: exwm-systemtray--selection-owner-window"))
     ;; Set the _NET_SYSTEM_TRAY_ORIENTATION property.
     (xcb:+request exwm-systemtray--connection
         (make-instance 'xcb:xembed:set-_NET_SYSTEM_TRAY_ORIENTATION
@@ -423,7 +427,7 @@ You shall use the default value if using auto-hide minibuffer."
   ;; Create the embedder.
   (let ((id (xcb:generate-id exwm-systemtray--connection))
         frame parent depth y)
-    (setq exwm-systemtray--embedder id)
+    (setq exwm-systemtray--embedder-window id)
     (if (exwm-workspace--minibuffer-own-frame-p)
         (setq frame exwm-workspace--minibuffer
               y (if (>= (line-pixel-height) exwm-systemtray-height)
@@ -460,7 +464,8 @@ You shall use the default value if using auto-hide minibuffer."
     ;; Set _NET_WM_NAME.
     (xcb:+request exwm-systemtray--connection
         (make-instance 'xcb:ewmh:set-_NET_WM_NAME
-                       :window id :data "EXWM system tray embedder")))
+                       :window id
+                       :data "EXWM: exwm-systemtray--embedder-window")))
   (xcb:flush exwm-systemtray--connection)
   ;; Attach event listeners.
   (xcb:+event exwm-systemtray--connection 'xcb:DestroyNotify
@@ -494,10 +499,10 @@ You shall use the default value if using auto-hide minibuffer."
     ;; parent of the embedder).
     (xcb:+request exwm-systemtray--connection
         (make-instance 'xcb:UnmapWindow
-                       :window exwm-systemtray--embedder))
+                       :window exwm-systemtray--embedder-window))
     (xcb:+request exwm-systemtray--connection
         (make-instance 'xcb:ReparentWindow
-                       :window exwm-systemtray--embedder
+                       :window exwm-systemtray--embedder-window
                        :parent exwm--root
                        :x 0
                        :y 0))
@@ -505,7 +510,7 @@ You shall use the default value if using auto-hide minibuffer."
     (setq exwm-systemtray--connection nil
           exwm-systemtray--list nil
           exwm-systemtray--selection-owner-window nil
-          exwm-systemtray--embedder nil)
+          exwm-systemtray--embedder-window nil)
     (remove-hook 'exwm-workspace-switch-hook
                  #'exwm-systemtray--on-workspace-switch)
     (remove-hook 'exwm-workspace--update-workareas-hook
diff --git a/exwm.el b/exwm.el
index 9f9b6f468105..fd824f099f44 100644
--- a/exwm.el
+++ b/exwm.el
@@ -665,15 +665,15 @@
                        :visual 0
                        :value-mask xcb:CW:OverrideRedirect
                        :override-redirect 1))
+    ;; Set _NET_WM_NAME
+    (xcb:+request exwm--connection
+        (make-instance 'xcb:ewmh:set-_NET_WM_NAME
+                       :window new-id :data "EXWM: exwm--guide-window"))
     (dolist (i (list exwm--root new-id))
       ;; Set _NET_SUPPORTING_WM_CHECK
       (xcb:+request exwm--connection
           (make-instance 'xcb:ewmh:set-_NET_SUPPORTING_WM_CHECK
-                         :window i :data new-id))
-      ;; Set _NET_WM_NAME
-      (xcb:+request exwm--connection
-          (make-instance 'xcb:ewmh:set-_NET_WM_NAME
-                         :window i :data "EXWM"))))
+                         :window i :data new-id))))
   ;; Set _NET_DESKTOP_VIEWPORT (we don't support large desktop).
   (xcb:+request exwm--connection
       (make-instance 'xcb:ewmh:set-_NET_DESKTOP_VIEWPORT
@@ -712,7 +712,7 @@ manager.  If t, replace it, if nil, abort and ask the user if `ask'."
                          :override-redirect 0))
       (xcb:+request exwm--connection
           (make-instance 'xcb:ewmh:set-_NET_WM_NAME
-                         :window new-owner :data "EXWM selection owner"))
+                         :window new-owner :data "EXWM: exwm--wmsn-window"))
       (xcb:+request-checked+request-check exwm--connection
           (make-instance 'xcb:SetSelectionOwner
                          :selection xcb:Atom:WM_S0