diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-05-28 14:23:57 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-30 12:49:54 +0200 |
commit | de3d449dcff4ee00fea72b3697055f5459fb13ec (patch) | |
tree | 9b9b56b938c16bc1f47a7ae39cd5a76c0a51b7f1 /src | |
parent | 1df7a6a50a794721edb1bc63d268378f4f0ed7c4 (diff) |
Windows: Suppress mouse events synthesized by OS.
Change the hint for
QPlatformIntegration::SynthesizeMouseFromTouchEvents to false
for Windows and suppress the events synthesized by OS.
The synthesized events cause touch events to generate 2 clicks
in Quick2.
Leave code as is for Windows CE.
Task-number: QTBUG-31386
Change-Id: Ia0987342dcdd55c8540810da5e4b90518a501ce6
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsintegration.cpp | 4 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsmousehandler.cpp | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 73df3ec032..814892b43a 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -552,11 +552,15 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co break; case QPlatformIntegration::UseRtlExtensions: return QVariant(d->m_context.useRTLExtensions()); +#ifdef Q_OS_WINCE case QPlatformIntegration::SynthesizeMouseFromTouchEvents: // We do not want Qt to synthesize mouse events as Windows also does that. // Alternatively, Windows-generated touch mouse events can be identified and // ignored by checking GetMessageExtraInfo() for MI_WP_SIGNATURE (0xFF515700). return false; +#endif // Q_OS_WINCE + default: + break; } return QPlatformIntegration::styleHint(hint); } diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index fd00a07d6c..5c096b7eca 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -157,9 +157,19 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result) { + enum { signatureMask = 0xffffff00, miWpSignature = 0xff515700 }; + if (et == QtWindows::MouseWheelEvent) return translateMouseWheelEvent(window, hwnd, msg, result); +#ifndef Q_OS_WINCE + // Check for events synthesized from touch. Lower byte is touch index, 0 means pen. + const LPARAM extraInfo = GetMessageExtraInfo(); + const bool fromTouch = (extraInfo & signatureMask) == miWpSignature && (extraInfo & 0xff); + if (fromTouch) + return false; +#endif // !Q_OS_WINCE + const QPoint winEventPosition(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); if (et & QtWindows::NonClientEventFlag) { const QPoint globalPosition = winEventPosition; |