branch: externals/xelb commit 7f44908270589efe712b9cadd4be36de3216d4ce Author: Chris Feng <chris.w.f...@gmail.com> Commit: Chris Feng <chris.w.f...@gmail.com>
Add optional arguments to force refreshing atoms * xcb-ewmh.el (xcb:ewmh:init) * xcb-icccm.el (xcb:icccm:init, xcb:icccm:intern-atoms): * xcb-systemtray.el (xcb:systemtray:init): * xcb-xembed.el (xcb:xembed:init): Add optional arguments to force refreshing atoms. --- xcb-ewmh.el | 6 +++--- xcb-icccm.el | 11 ++++++----- xcb-systemtray.el | 6 +++--- xcb-xembed.el | 6 +++--- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/xcb-ewmh.el b/xcb-ewmh.el index a600a7f..c1c3513 100644 --- a/xcb-ewmh.el +++ b/xcb-ewmh.el @@ -138,18 +138,18 @@ (dolist (atom xcb:ewmh:-atoms) (eval `(defvar ,(intern (concat "xcb:Atom:" (symbol-name atom))) nil)))) -(cl-defmethod xcb:ewmh:init ((obj xcb:connection)) +(cl-defmethod xcb:ewmh:init ((obj xcb:connection) &optional force) "Initialize EWMH module. This method must be called before using any other method in this module. This method also initializes ICCCM module automatically." - (unless xcb:Atom:_NET_SUPPORTED + (when (or force (not xcb:Atom:_NET_SUPPORTED)) (xcb:icccm:init obj) ;required (let ((atoms xcb:ewmh:-atoms)) (dotimes (i (x-display-screens)) (push (intern (format "_NET_WM_CM_S%d" i)) atoms)) - (xcb:icccm:intern-atoms obj atoms)))) + (xcb:icccm:intern-atoms obj atoms force)))) ;;;; Client message diff --git a/xcb-icccm.el b/xcb-icccm.el index c787161..8532d91 100644 --- a/xcb-icccm.el +++ b/xcb-icccm.el @@ -54,21 +54,22 @@ (dolist (atom xcb:icccm:-atoms) (eval `(defvar ,(intern (concat "xcb:Atom:" (symbol-name atom))) nil)))) -(cl-defmethod xcb:icccm:init ((obj xcb:connection)) +(cl-defmethod xcb:icccm:init ((obj xcb:connection) &optional force) "Initialize ICCCM module. This method must be called before using any other method in this module." - (unless xcb:Atom:WM_PROTOCOLS - (xcb:icccm:intern-atoms obj xcb:icccm:-atoms))) + (when (or force (not xcb:Atom:WM_PROTOCOLS)) + (xcb:icccm:intern-atoms obj xcb:icccm:-atoms force))) -(cl-defmethod xcb:icccm:intern-atoms ((obj xcb:connection) atoms) +(cl-defmethod xcb:icccm:intern-atoms ((obj xcb:connection) atoms + &optional force) "Intern the X atoms listed in the list AOTMS. The value of these atoms will be available in `xcb:Atom' namespace." (dolist (atom atoms) (let* ((name (symbol-name atom)) (var-name (intern (concat "xcb:Atom:" name)))) - (unless (and (boundp var-name) (symbol-value var-name)) + (when (or force (not (and (boundp var-name) (symbol-value var-name)))) (set var-name (slot-value (xcb:+request-unchecked+reply obj (make-instance 'xcb:InternAtom diff --git a/xcb-systemtray.el b/xcb-systemtray.el index fa45188..9abdaf2 100644 --- a/xcb-systemtray.el +++ b/xcb-systemtray.el @@ -55,16 +55,16 @@ (defconst xcb:systemtray:opcode:BEGIN-MESSAGE 1) (defconst xcb:systemtray:opcode:CANCEL-MESSAGE 2) -(cl-defmethod xcb:systemtray:init ((obj xcb:connection)) +(cl-defmethod xcb:systemtray:init ((obj xcb:connection) &optional force) "Initialize the system tray module. This method must be called before using any other method in this module." - (unless xcb:Atom:_NET_SYSTEM_TRAY_OPCODE + (when (or force (not xcb:Atom:_NET_SYSTEM_TRAY_OPCODE)) (xcb:ewmh:init obj) ;required. (let ((atoms xcb:systemtray:-atoms)) (dotimes (i (x-display-screens)) (push (intern (format "_NET_SYSTEM_TRAY_S%d" i)) atoms)) - (xcb:icccm:intern-atoms obj atoms)))) + (xcb:icccm:intern-atoms obj atoms force)))) (defclass xcb:systemtray:SendEvent (xcb:SendEvent) ((propagate :initform 0) diff --git a/xcb-xembed.el b/xcb-xembed.el index ab94e6d..bde5e18 100644 --- a/xcb-xembed.el +++ b/xcb-xembed.el @@ -61,12 +61,12 @@ (defconst xcb:xembed:opcode:UNREGISTER-ACCELERATOR 13) (defconst xcb:xembed:opcode:ACTIVATE-ACCELERATOR 14) -(cl-defmethod xcb:xembed:init ((obj xcb:connection)) +(cl-defmethod xcb:xembed:init ((obj xcb:connection) &optional force) "Initialize the XEmbed module. This method must be called before using any other method in this module." - (unless xcb:Atom:_XEMBED_INFO - (xcb:icccm:intern-atoms obj xcb:xembed:-atoms))) + (when (or force (not xcb:Atom:_XEMBED_INFO)) + (xcb:icccm:intern-atoms obj xcb:xembed:-atoms force))) ;; Flags for _XEMBED_INFO. (defconst xcb:xembed:MAPPED 1)