diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-10-16 11:50:27 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-10-26 10:14:05 +0200 |
commit | e3470a98e98c8a789a4cb298a0afaacf0cc62ce9 (patch) | |
tree | 346f0960c073bfb87fd2969fc89dc693fab48e96 /src/plugins/platforms/windows/qwindowscontext.cpp | |
parent | d9edad81177954c89619b6dee70ca76f2f4709ef (diff) |
Windows QPA: Use a QSharedPointer for the touch device
For reasons of symmetry with the tablet devices.
As a drive by, give it more distinct IDs.
Task-number: QTBUG-46412
Change-Id: Ie667621246b26db6fdda84c5ff2455fe38633cb3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 1e5b247f0f..b2cbae408c 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -349,19 +349,16 @@ bool QWindowsContext::initTouch(unsigned integrationOptions) return true; const bool usePointerHandler = (d->m_systemInfo & QWindowsContext::SI_SupportsPointer) != 0; auto touchDevice = usePointerHandler ? d->m_pointerHandler.touchDevice() : d->m_mouseHandler.touchDevice(); - if (!touchDevice) { + if (touchDevice.isNull()) { const bool mouseEmulation = (integrationOptions & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch) == 0; touchDevice = QWindowsPointerHandler::createTouchDevice(mouseEmulation); } - if (!touchDevice) + if (touchDevice.isNull()) return false; - if (usePointerHandler) - d->m_pointerHandler.setTouchDevice(touchDevice); - else - d->m_mouseHandler.setTouchDevice(touchDevice); - - QWindowSystemInterface::registerInputDevice(touchDevice); + d->m_pointerHandler.setTouchDevice(touchDevice); + d->m_mouseHandler.setTouchDevice(touchDevice); + QWindowSystemInterface::registerInputDevice(touchDevice.data()); d->m_systemInfo |= QWindowsContext::SI_SupportsTouch; @@ -1637,12 +1634,6 @@ void QWindowsContext::setAsyncExpose(bool value) d->m_asyncExpose = value; } -QPointingDevice *QWindowsContext::touchDevice() const -{ - return (d->m_systemInfo & QWindowsContext::SI_SupportsPointer) ? - d->m_pointerHandler.touchDevice() : d->m_mouseHandler.touchDevice(); -} - DWORD QWindowsContext::readAdvancedExplorerSettings(const wchar_t *subKey, DWORD defaultValue) { const auto value = |