diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2013-04-12 16:57:04 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-07 14:30:50 +0200 |
commit | dd7058898c423617c6d7f6d5c576e23eee0fe773 (patch) | |
tree | 3561b54506f4db12d94a8f2d12011fed74e96f7e /src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | |
parent | df93d356df528a4449be3caa72dfc58fc91132dd (diff) |
xcb: don't do mouse synthesis from touch unless we find a reason
One reason is when we are using XInput 2.2, because touch devices
will then generate touch events only. For the other X11 scenarios,
X11 does its own mouse emulation.
QPlatformIntegration::styleHint() wasn't overridden yet. The remaining
hints are TODO for now.
Change-Id: I2e444a00a18b33ed840ebfa8d8218655c2c39aad
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection_xi2.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index dfd4feb254..991c82eaaa 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -92,6 +92,9 @@ void QXcbConnection::initializeXInput2() // Tablet support: Find the stylus-related devices. xi2SetupTabletDevices(); #endif // QT_NO_TABLETEVENT +#ifdef XI2_TOUCH_DEBUG + qDebug("XInput version %d.%d is supported", xiMajor, m_xi2Minor); +#endif } } } @@ -118,7 +121,16 @@ void QXcbConnection::xi2Select(xcb_window_t window) mask.deviceid = XIAllMasterDevices; mask.mask_len = sizeof(bitMask); mask.mask = xiBitMask; - XISelectEvents(xDisplay, window, &mask, 1); + Status result = XISelectEvents(xDisplay, window, &mask, 1); + // If we have XInput 2.2 and successfully enable touch on the master + // devices, then evdev touchscreens will provide touch only. In most other + // cases, there will be emulated mouse events, because true X11 touch + // support is so new that for the older drivers, mouse emulation was the + // only way; and it's still the fallback even with the modern evdev driver. + // But if neither Qt nor X11 does mouse emulation, it will not be possible + // to interact with mouse-oriented QWidgets; so we have to let Qt do it. + if (m_xi2Minor >= 2 && result == Success) + has_touch_without_mouse_emulation = true; #endif #ifndef QT_NO_TABLETEVENT |