xproto.xml misses PointerEvent / DeviceEvent enums
What is the situation?
xproto.xml only contains <enum name="EventMask">
and uses this enumeration for all event masks. However, the X11 core protocol has three different kinds. From https://www.x.org/releases/X11R7.6/doc/xproto/x11protocol.html:
SETofEVENT
[SNIP - all the events]
#xFE000000 unused but must be zero
SETofPOINTEREVENT
encodings are the same as for SETofEVENT, except with
#xFFFF8003 unused but must be zero
SETofDEVICEEVENT
encodings are the same as for SETofEVENT, except with
#xFFFFC0B0 unused but must be zero
Looking through that document, I find that
- SETofDEVICEEVENT is used for the
do-not-propagate-mask
in CreateWindow and GetWindowAttributes - SETofPOINTEREVENT is used for the
event-mask
in GrabPointer, GrabButton, ChangeActivePointerGrab
In fact, do-not-propagate-mask
and event-mask
are only two bytes large while SETofEVENT
contains values up to 1 << 24
.
Why is that a problem?
I guess this is not a problem in C thanks to implicit integer conversions. However, I am writing Rust bindings and there the equivalent of EventMask
can be converted (speaking in C types) to uint32_t
, but not to uint16_t
, because there are possible values outside of that range.
See https://github.com/psychon/x11rb/issues/543 and https://github.com/psychon/x11rb/issues/542 and https://github.com/psychon/x11rb/issues/746
What could be done about it?
Of course, adding the two other kinds of event masks to the XML would help. It would also help if these new enums would be used for the affected requests, but I am not sure whether that could break libxcb API/ABI. Hence, I am opening this issue as a place to discuss possible solutions.
Are extensions also affected?
I'm not sure. git grep EventMask
suggests that only screensaver.xml
refers to EventMask
, but I am not 100% sure. https://www.x.org/releases/X11R7.7/doc/scrnsaverproto/saver.html does not really explain the event mask used in ScreenSaverSetAttributes
.