diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 1 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 14 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 26 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.h | 1 |
5 files changed, 43 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 10a8f26614..a7c60cac84 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -257,6 +257,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra , has_shape_extension(false) , has_randr_extension(false) , has_input_shape(false) + , has_touch_without_mouse_emulation(false) , m_buttons(0) , m_focusWindow(0) { diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 44c0e28dd5..1d6f09a2bc 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -401,6 +401,7 @@ public: bool hasXShape() const { return has_shape_extension; } bool hasXRandr() const { return has_randr_extension; } bool hasInputShape() const { return has_input_shape; } + bool hasTouchWithoutMouseEmulation() const { return has_touch_without_mouse_emulation; } bool supportsThreadedRendering() const { return m_reader->isRunning(); } @@ -543,6 +544,7 @@ private: bool has_shape_extension; bool has_randr_extension; bool has_input_shape; + bool has_touch_without_mouse_emulation; Qt::MouseButtons m_buttons; 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 diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index dd1466d23c..de26353e1b 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -337,4 +337,30 @@ QPlatformTheme *QXcbIntegration::createPlatformTheme(const QString &name) const return QGenericUnixTheme::createUnixTheme(name); } +QVariant QXcbIntegration::styleHint(QPlatformIntegration::StyleHint hint) const +{ + switch (hint) { + case QPlatformIntegration::CursorFlashTime: + case QPlatformIntegration::KeyboardInputInterval: + case QPlatformIntegration::MouseDoubleClickInterval: + case QPlatformIntegration::StartDragDistance: + case QPlatformIntegration::StartDragTime: + case QPlatformIntegration::KeyboardAutoRepeatRate: + case QPlatformIntegration::PasswordMaskDelay: + case QPlatformIntegration::FontSmoothingGamma: + case QPlatformIntegration::StartDragVelocity: + case QPlatformIntegration::UseRtlExtensions: + // TODO using various xcb, gnome or KDE settings + break; // Not implemented, use defaults + case QPlatformIntegration::ShowIsFullScreen: + // X11 always has support for windows, but the + // window manager could prevent it (e.g. matchbox) + return false; + case QPlatformIntegration::SynthesizeMouseFromTouchEvents: + // We do not want Qt to synthesize mouse events if X11 already does it. + return m_connections.at(0)->hasTouchWithoutMouseEmulation(); + } + return QPlatformIntegration::styleHint(hint); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index 451dc43475..fad5222049 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -94,6 +94,7 @@ public: QStringList themeNames() const; QPlatformTheme *createPlatformTheme(const QString &name) const; + QVariant styleHint(StyleHint hint) const; QXcbConnection *defaultConnection() const { return m_connections.first(); } |