summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanthosh Kumar <santhosh.kumar.selvaraj@qt.io>2023-09-21 17:39:50 +0200
committerSanthosh Kumar <santhosh.kumar.selvaraj@qt.io>2023-12-14 02:25:33 +0100
commit6ef62f7dc4d6cb690fc297954b3cfcd1de415910 (patch)
tree185a32d67f659d21152e9f1fbbe2a81fccb21f2d
parent0c3892bb261f0eebebdff4cf42169f49729956a9 (diff)
Fix hang issue during drag and drop in windows
During drag and drop operation, we used to get window under mouse and process events for that window after the patch set 9ff5b886fade489b7cc268626f518145650f6b2c. But this sometimes cause hang issue in GetMessage() when the respective window doesn't capture mouse event and we are required to process mouse events. This patch fixes this issue by considering whether the window under mouse has capture. Fixes: QTBUG-115260 Pick-to: 6.7 6.6 6.5 6.2 Change-Id: I748936e4ce23e60abce51d34c1326cfb105b06cb Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index 6543543888..e8ec8d24a2 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -650,7 +650,8 @@ IDropTargetHelper* QWindowsDrag::dropHelper() {
static HRESULT startDoDragDrop(LPDATAOBJECT pDataObj, LPDROPSOURCE pDropSource, DWORD dwOKEffects, LPDWORD pdwEffect)
{
QWindow *underMouse = QWindowsContext::instance()->windowUnderMouse();
- const HWND hwnd = underMouse ? reinterpret_cast<HWND>(underMouse->winId()) : ::GetFocus();
+ const bool hasMouseCapture = underMouse && static_cast<QWindowsWindow *>(underMouse->handle())->hasMouseCapture();
+ const HWND hwnd = hasMouseCapture ? reinterpret_cast<HWND>(underMouse->winId()) : ::GetFocus();
bool starting = false;
for (;;) {