summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-05-28 14:23:57 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-30 12:49:54 +0200
commitde3d449dcff4ee00fea72b3697055f5459fb13ec (patch)
tree9b9b56b938c16bc1f47a7ae39cd5a76c0a51b7f1 /src/plugins
parent1df7a6a50a794721edb1bc63d268378f4f0ed7c4 (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/plugins')
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp10
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;