From de3d449dcff4ee00fea72b3697055f5459fb13ec Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 28 May 2013 14:23:57 +0200 Subject: 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 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/windows/qwindowsintegration.cpp | 4 ++++ src/plugins/platforms/windows/qwindowsmousehandler.cpp | 10 ++++++++++ 2 files changed, 14 insertions(+) (limited to 'src') 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; -- cgit v1.2.3