summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-09-06 11:16:29 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-09 14:49:33 +0200
commit560de9725da348e2810c700dda6b25a668e8bd58 (patch)
treea9404c74e20580ec0885870d70cdf8a0923f3a9d /src/plugins/platforms
parentc03d0a984682ce5cea5a5882bab0075318b18f08 (diff)
Windows: Add command line parameter enabling OS-synthesized mouse events from touch.
Applications launched with -platform windows:mousefromtouch will receive OS-synthesized mouse events. Task-number: QTBUG-31386 Change-Id: I1c49486589c4a7fa4fb5525f7a5adca09b1cfb89 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h3
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp11
3 files changed, 15 insertions, 7 deletions
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 754d7a0288..5f1f9cf149 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -342,6 +342,8 @@ static inline unsigned parseOptions(const QStringList &paramList)
}
} else if (param == QLatin1String("gl=gdi")) {
options |= QWindowsIntegration::DisableArb;
+ } else if (param == QLatin1String("mousefromtouch")) {
+ options |= QWindowsIntegration::PassOsMouseEventsSynthesizedFromTouch;
}
}
return options;
@@ -557,13 +559,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:
+#ifdef Q_OS_WINCE
// 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
+#else // Q_OS_WINCE
+ return QVariant(!(d->m_options & PassOsMouseEventsSynthesizedFromTouch));
+#endif // !Q_OS_WINCE
default:
break;
}
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index ca484415be..b3854d673a 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -58,7 +58,8 @@ public:
FontDatabaseNative = 0x2,
DisableArb = 0x4,
NoNativeDialogs = 0x8,
- XpNativeDialogs = 0x10
+ XpNativeDialogs = 0x10,
+ PassOsMouseEventsSynthesizedFromTouch = 0x20 // Pass OS-generated mouse events from touch.
};
explicit QWindowsIntegration(const QStringList &paramList);
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 43286eadf3..3782b7e020 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -169,10 +169,13 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
#ifndef Q_OS_WINCE
// Check for events synthesized from touch. Lower byte is touch index, 0 means pen.
- const quint64 extraInfo = GetMessageExtraInfo();
- const bool fromTouch = (extraInfo & signatureMask) == miWpSignature && (extraInfo & 0xff);
- if (fromTouch)
- return false;
+ static const bool passSynthesizedMouseEvents = QWindowsIntegration::instance()->options() & QWindowsIntegration::PassOsMouseEventsSynthesizedFromTouch;
+ if (!passSynthesizedMouseEvents) {
+ const quint64 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));