exwm-systemtray--init, exwm-xsettings--init: Idempotent initialization

* exwm-systemtray.el (exwm-systemtray--init),
  exwm-xsettings.el (exwm-xsettings--init):
  Return early if already initialized.
This commit is contained in:
Daniel Mendler 2024-06-06 10:04:44 +02:00
parent 63bde86545
commit d41de490e3
No known key found for this signature in database
GPG key ID: D88ADB2A2693CA43
2 changed files with 6 additions and 2 deletions

View file

@ -491,7 +491,9 @@ Argument DATA contains the raw event data."
(cl-defun exwm-systemtray--init () (cl-defun exwm-systemtray--init ()
"Initialize system tray module." "Initialize system tray module."
(exwm--log) (exwm--log)
(cl-assert (not exwm-systemtray--connection)) ;; idempotent initialization
(when exwm-systemtray--connection
(cl-return-from exwm-systemtray--init))
(cl-assert (not exwm-systemtray--list)) (cl-assert (not exwm-systemtray--list))
(cl-assert (not exwm-systemtray--selection-owner-window)) (cl-assert (not exwm-systemtray--selection-owner-window))
(cl-assert (not exwm-systemtray--embedder-window)) (cl-assert (not exwm-systemtray--embedder-window))

View file

@ -238,7 +238,9 @@ SERIAL is a sequence number."
"Initialize the XSETTINGS module." "Initialize the XSETTINGS module."
(exwm--log) (exwm--log)
(cl-assert (not exwm-xsettings--connection)) ;; idempotent initialization
(when exwm-xsettings--connection
(cl-return-from exwm-xsettings--init))
;; Connect ;; Connect
(setq exwm-xsettings--connection (xcb:connect)) (setq exwm-xsettings--connection (xcb:connect))