Created attachment 585508 [details, diff]
Workaround for broken input mask handling in qxcbconnection_xi2.cpp
Qt5 uses libxcb to set up input masks for XInput2. However, it does not follow
the correct format for an input mask. Because of this Qt will not get all the
events it wants resulting in the mouse wheel not being handled.
How to reproduce:
1) Run a Qt5 application on any big endian system supporting XInput
2) Try to use the mouse wheel
* No mouse wheel events are sent to the application
* Mouse wheel events are sent to the application
Input masks in XInput2 are arrays of bytes. Xlib provides convenience
macros XISetMask(), XIClearMask() and XIMaskIsSet() for finding the correct
byte in case the event number is 8 or larger. However, Qt does not set up
an array of bytes but rather a single 32-bit integer, and assumes that as long
as all events have numbers smaller than 32 it can just set the corresponding
bit in the 32-bit integer. This happens to work on little endian since the
byte order on LE matches the hard-coded byte order of the input masks in
XInput2. However, it does not work on big endian where the byte order differs.
In my proposed patch, I did not rewrite the code to use an array of bytes but
simply added a conversion to little endian of the 32-bit integer, which solves
the immediate issue.
Has this been reported upstream? I see no signs of that commit even in current upstream dev branch.