53d289ec4c fixed the issue of not getting
touch events when grabbing via the plain xcb functions. And due to wanting
to support a setup where mouse events are delivered via core events it was
chosen to use mouse via XI2 only when really necessary. Thus starting only
from 2.2, the version from which the mouse+touch grabbing becomes the issue
(XI2 introduced touch support from 2.2).
The same patch states that using QT_XCB_NO_XI2_MOUSE restores to the old
behavior (grabbing via core) with broken touch grabbing. Broken only with
2.2+, not 2.0 and 2.1 since those versions of protocol do not know about touch.
All of this implies the following:
1) The user code that already depends on QT_XCB_NO_XI2_MOUSE, won't see any
behavioural difference if we will use XInput starting from 2.0 for mouse.
Mouse grabbing will continue to be done via core (xcb_grab_pointer) as
mentioned above and thus touch grabbing will continue to be broken with 2.2+.
2) The code that has never cared how we get the native events (core vs
xinput2), won't see any behavioural difference. In this case grabbing will
always be done via XI2 (XIGrabDevice) grab when XI2.0+ is available.
Since there is no difference in the outcome, we migth as well use XI2 for
mouse from 2.0, not 2.2. Extension events are always better choice than core.
Besides the broken touch grabbing issue with QT_XCB_NO_XI2_MOUSE, there are
other issues with that code path, for details see internal documentation of
xi2SelectDeviceEventsCompatibility(), where the conclusion is:
*** If your code relies on QT_XCB_NO_XI2_MOUSE, then your code needs fixing. ***
This patch also cleans up how we select XInput2 events, by separating
the QT_XCB_NO_XI2_MOUSE code path. This has two benefits - improved code
readability and will make the deprecation of QT_XCB_NO_XI2_MOUSE easier.
The patch removes some sparse comments as the behavior is now documented in
one place, see xi2SelectDeviceEventsCompatibility().
[ChangeLog][Platform Specific Changes][Linux] The QT_XCB_NO_XI2_MOUSE
environment variable is deprecated and will be removed in Qt 6. If your
application relies on behavior set by QT_XCB_NO_XI2_MOUSE, it should be
updated accordingly.
[ChangeLog][Platform Specific Changes][Linux] Pointer event delivery on
X11 is now done starting from XInput version 2.0 (when available) instead
of 2.2. XInput support can be disabled by setting QT_XCB_NO_XI2=1 environment
variable. Note that using QT_XCB_NO_XI2 would also disable tablet and touch
support.
Change-Id: I661b36d6710b9f6ec71fecc8287ba479432bff4c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>