summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowswindow.cpp
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2014-12-18 10:02:47 +0100
committerAndy Shaw <andy.shaw@digia.com>2015-01-05 07:49:15 +0100
commitf444b25ac1dfe240b5ae592717907b15d30a5c21 (patch)
tree227e1f674a38c7def07aa3284d5d522bbb449b04 /src/plugins/platforms/windows/qwindowswindow.cpp
parent84a3dacf462a4170a7fbc71b012fbb2db2c34a19 (diff)
Add a platform function to enable setting the touch flags on Windows
This makes it possible for the flags that RegisterTouchWindow takes to be specified after the window has been created. Task-number: QTBUG-41433 Change-Id: I166143875ef54ab6a249cffb31d017845a694a01 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowswindow.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 7d67aa0d09..b7de580c44 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -889,16 +889,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data)
#endif // QT_NO_OPENGL
updateDropSite();
-#ifndef Q_OS_WINCE
- if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)
- && aWindow->type() != Qt::ForeignWindow) {
- if (QWindowsContext::user32dll.registerTouchWindow(m_data.hwnd, 0)) {
- setFlag(TouchRegistered);
- } else {
- qErrnoWarning("RegisterTouchWindow() failed for window '%s'.", qPrintable(aWindow->objectName()));
- }
- }
-#endif // !Q_OS_WINCE
+ registerTouchWindow();
setWindowState(aWindow->windowState());
const qreal opacity = qt_window_private(aWindow)->opacity;
if (!qFuzzyCompare(opacity, qreal(1.0)))
@@ -2317,4 +2308,24 @@ void *QWindowsWindow::surface(void *nativeConfig)
#endif
}
+void QWindowsWindow::setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes)
+{
+ if (!window->handle())
+ return;
+ static_cast<QWindowsWindow *>(window->handle())->registerTouchWindow(touchTypes);
+}
+
+void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes)
+{
+#ifndef Q_OS_WINCE
+ if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)
+ && window()->type() != Qt::ForeignWindow) {
+ if (QWindowsContext::user32dll.registerTouchWindow(m_data.hwnd, (ULONG)touchTypes))
+ setFlag(TouchRegistered);
+ else
+ qErrnoWarning("RegisterTouchWindow() failed for window '%s'.", qPrintable(window()->objectName()));
+ }
+#endif // !Q_OS_WINCE
+}
+
QT_END_NAMESPACE