diff options
author | Andre de la Rocha <andre.rocha@qt.io> | 2019-02-04 19:25:31 +0100 |
---|---|---|
committer | Andre de la Rocha <andre.rocha@qt.io> | 2019-02-12 22:17:54 +0000 |
commit | 38504041148f2d1cffea6520ea448dd4171adb0b (patch) | |
tree | 77d60e06d5f2381783ab44001a0b4d3395eff67d /src/plugins/platforms/windows/qwindowscontext.cpp | |
parent | 80bcfa776f9243641484181a18090b34147e8e30 (diff) |
Windows QPA: Handle mouse input using legacy messages
This change reverts to using legacy mouse messages when handling mouse
and touchpad input, while using pointer messages to handle touchscreen
and pen input. The use of pointer messages to handle everything, added
in 5.12.0, caused issues in some particular cases, due mainly to
differences in behavior or bugs in the pointer messages, which required
workarounds in the Windows QPA, which didn't work well in all cases and
led to additional issues. For instance, DoDragDrop() does not work when
called by pointer (or touch/pen) handlers, but only after OS-synthesized
legacy mouse messages are generated. Also, in some cases pointer messages
for mouse movement are generated as non-client for client area events.
Modal loops like the ones in window resize/move and menu handling caused
some issues with pointer messages, as well. Also, we have to handle the
OS-synthesized legacy mouse message generated for touch and pen. Ignoring
them while letting the gui layer synthesize mouse events for touch/pen
may break Drag and Drop by triggering DoDragDrop() before legacy messages,
which can result in a hang inside the DoDragDrop() modal loop. This change
should fix most regressions related to pointer messages, while keeping
the enhancements in pen and touch input.
Fixes: QTBUG-73389
Fixes: QTBUG-72624
Fixes: QTBUG-72801
Fixes: QTBUG-73290
Fixes: QTBUG-72458
Fixes: QTBUG-73358
Fixes: QTBUG-72992
Change-Id: I919f78930d3965270ef2094401e827ab87174979
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 2b96fb3a5e..41655dbd57 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -334,12 +334,8 @@ bool QWindowsContext::initTouch(unsigned integrationOptions) if (!touchDevice) return false; - if (d->m_systemInfo & QWindowsContext::SI_SupportsPointer) { - QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false); - } else { - if (!(integrationOptions & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch)) - touchDevice->setCapabilities(touchDevice->capabilities() | QTouchDevice::MouseEmulation); - } + if (!(integrationOptions & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch)) + touchDevice->setCapabilities(touchDevice->capabilities() | QTouchDevice::MouseEmulation); QWindowSystemInterface::registerTouchDevice(touchDevice); @@ -376,7 +372,6 @@ bool QWindowsContext::initPointer(unsigned integrationOptions) if (!QWindowsContext::user32dll.supportsPointerApi()) return false; - QWindowsContext::user32dll.enableMouseInPointer(TRUE); d->m_systemInfo |= QWindowsContext::SI_SupportsPointer; return true; } @@ -1218,9 +1213,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::ExposeEvent: return platformWindow->handleWmPaint(hwnd, message, wParam, lParam); case QtWindows::NonClientMouseEvent: - if (!(d->m_systemInfo & QWindowsContext::SI_SupportsPointer) && platformWindow->frameStrutEventsEnabled()) + if ((d->m_systemInfo & QWindowsContext::SI_SupportsPointer) && platformWindow->frameStrutEventsEnabled()) + return sessionManagerInteractionBlocked() || d->m_pointerHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); + else return sessionManagerInteractionBlocked() || d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); - break; case QtWindows::NonClientPointerEvent: if ((d->m_systemInfo & QWindowsContext::SI_SupportsPointer) && platformWindow->frameStrutEventsEnabled()) return sessionManagerInteractionBlocked() || d->m_pointerHandler.translatePointerEvent(platformWindow->window(), hwnd, et, msg, result); @@ -1246,10 +1242,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, window = window->parent(); if (!window) return false; - if (!(d->m_systemInfo & QWindowsContext::SI_SupportsPointer)) - return sessionManagerInteractionBlocked() || d->m_mouseHandler.translateMouseEvent(window, hwnd, et, msg, result); - else + if (d->m_systemInfo & QWindowsContext::SI_SupportsPointer) return sessionManagerInteractionBlocked() || d->m_pointerHandler.translateMouseEvent(window, hwnd, et, msg, result); + else + return sessionManagerInteractionBlocked() || d->m_mouseHandler.translateMouseEvent(window, hwnd, et, msg, result); } break; case QtWindows::TouchEvent: |