From e3470a98e98c8a789a4cb298a0afaacf0cc62ce9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 16 Oct 2020 11:50:27 +0200 Subject: 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 --- src/plugins/platforms/windows/qwindowscontext.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowscontext.cpp') 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 = -- cgit v1.2.3