summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowspointerhandler.cpp
diff options
context:
space:
mode:
authorAndre de la Rocha <andre.rocha@qt.io>2018-12-03 20:49:06 +0100
committerAndre de la Rocha <andre.rocha@qt.io>2018-12-07 15:49:56 +0000
commitf184f1a4817f868bd17280c95b4117f48c9b4c23 (patch)
tree5453674abd1078b1cf03c1eef0e3695851803117 /src/plugins/platforms/windows/qwindowspointerhandler.cpp
parentb91e6befebe908dd40ed2249b3c6f5dfec02c340 (diff)
Windows QPA: Fix QDockWindow Drag & Drop
Pointer messages should not be handled when we are inside a move/resize modal loop. DefWindowProc() should handle this case instead. Fixes: QTBUG-72078 Change-Id: I5ad7283bcf0cfe0ff7d21cf5640270c361b8ad8d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowspointerhandler.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowspointerhandler.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
index 0bac382a90..14559d726a 100644
--- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp
+++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
@@ -187,6 +187,12 @@ static bool draggingActive()
bool QWindowsPointerHandler::translatePointerEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result)
{
*result = 0;
+
+ // If we are inside the move/resize modal loop, let DefWindowProc() handle it (but process NC button release).
+ QWindowsWindow *platformWindow = static_cast<QWindowsWindow *>(window->handle());
+ if (msg.message != WM_NCPOINTERUP && platformWindow->testFlag(QWindowsWindow::ResizeMoveActive))
+ return false;
+
const quint32 pointerId = GET_POINTERID_WPARAM(msg.wParam);
POINTER_INPUT_TYPE pointerType;
@@ -195,6 +201,18 @@ bool QWindowsPointerHandler::translatePointerEvent(QWindow *window, HWND hwnd, Q
return false;
}
+ // Handle non-client pen/touch as generic mouse events for compatibility with QDockWindow.
+ if ((pointerType == QT_PT_TOUCH || pointerType == QT_PT_PEN) && (et & QtWindows::NonClientEventFlag)) {
+ POINTER_INFO pointerInfo;
+ if (!QWindowsContext::user32dll.getPointerInfo(pointerId, &pointerInfo)) {
+ qWarning() << "GetPointerInfo() failed:" << qt_error_string();
+ return false;
+ }
+ if (pointerInfo.pointerFlags & (POINTER_FLAG_UP | POINTER_FLAG_DOWN))
+ return translateMouseTouchPadEvent(window, hwnd, et, msg, &pointerInfo);
+ return false;
+ }
+
switch (pointerType) {
case QT_PT_POINTER:
case QT_PT_MOUSE: