emacs-exwm / xelb

X protocol Emacs Lisp Binding
https://elpa.gnu.org/packages/xelb.html
GNU General Public License v3.0
27 stars 5 forks source link

Move classes from exwm-xsettings and exwm-systemtray here? #6

Closed minad closed 8 months ago

minad commented 9 months ago

@Stebalien You had already asked this on the xsettings pr. All protocol classes seem to be defined here, so we should probably do this. What do you think?

Stebalien commented 9 months ago

Yeah, that seems reasonable. Most of the files here are auto-generated, but not all of them.

minad commented 9 months ago

Okay, let's move these classes here. Maybe the xsetting and systemtray classes can also be auto-generated from some xml protocol definition?

Stebalien commented 9 months ago

Maybe the xsetting and systemtray classes can also be auto-generated from some xml protocol definition?

I didn't see any.

minad commented 9 months ago

Okay, we can simply copy the xsetting xcb classes over. It is a bit odd that exwm-systemtray.el and xcb-systemtray.el both define xcb:systemtray:-ClientMessage.

medranocalvo commented 9 months ago

Okay, we can simply copy the xsetting xcb classes over. It is a bit odd that exwm-systemtray.el and xcb-systemtray.el both define xcb:systemtray:-ClientMessage.

That's a bug. I'm not sure how to correct it yet, probably the right thing to do is to rename the one in exwm-systemtray.el to xcb:systemtray:-SelectionAnnounce or similar. We should check the conventions for manager selections in the ICCCM to see whether we can get some inspiration.

minad commented 9 months ago

@medranocalvo Thanks, I had suspected that. I will rename the class according to the convention and move it here. I am short on time for the next two weeks, but after that I will take a look at this issue.

medranocalvo commented 8 months ago

Had a brief look again. These messages are standard manager selection announce events (https://x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html#manager_selections):

Immediately after a manager successfully acquires ownership of a manager selection, it should announce its arrival by sending a ClientMessage event. This event should be sent using the SendEvent protocol request with the following arguments: [...]

I think that we should define this message in xcb-icccm.el, for example:

(defclass xcb:icccm:-AnnounceManagerSelection
  (xcb:icccm:--ClientMessage xcb:ClientMessage)
  ((format :initform 32)
   (type :initform 'xcb:Atom:MANAGER)
   (time :initarg :time :type xcb:TIMESTAMP)      ;new slot
   (selection :initarg :selection :type xcb:ATOM) ;new slot
   (owner :initarg :owner :type xcb:WINDOW))      ;new slot
  :documentation "A systemtray client message.")

(Please suggest better name.)

Both exwm-systemtray and exwm-xsettings should use this definition, unless they need to provide additional data. (I think they don't.)


This is tangential but want to note it down: we don't follow various conventions recommended by ICCCM for selections. For example, we use CurrentTime while it is discouraged and we don't check whether we actually did acquire the selection after SetSelectionOwner as recommended. It might pay to abstract this, I think I tried to when I worked on the systemtray, but ran out of time without much success. Something to keep in mind.