summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2023-02-23 10:39:28 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-01 11:45:34 +0000
commit1831105a380eeab06c06156d050fc66c04fa0171 (patch)
treeb1fc2cd4be3fde735c050fd007717c3e81586209 /src
parent09bf5a439e62dbd9b634b912ba6895862e17105b (diff)
Windows drag&drop: Use correct window for drag target processing
GetFocus will return the window that currently has keyboard focus. This is not what we want for drag and drop handling though. Use the window under mouse and process events for that window when doing the touch/pen input workaround. If no window is found we fall back to the focus window. Followup to 31e7790102b260344893eaa8bf8b7b1a0f95e3b7 Fixes: QTBUG-111149 Change-Id: Ib8233debc267df0cc19b21c1dc5c6881d018d84a Reviewed-by: Timothée Keller <timothee.keller@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit c912bde52a1b85a782db6aed8d6f9917d597f58b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-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 97f62221f7..0e12641fa8 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -684,7 +684,8 @@ IDropTargetHelper* QWindowsDrag::dropHelper() {
// We process pointer messages for touch/pen and generate mouse input through SendInput() to trigger DoDragDrop()
static HRESULT startDoDragDrop(LPDATAOBJECT pDataObj, LPDROPSOURCE pDropSource, DWORD dwOKEffects, LPDWORD pdwEffect)
{
- HWND hwnd = ::GetFocus();
+ QWindow *underMouse = QWindowsContext::instance()->windowUnderMouse();
+ const HWND hwnd = underMouse ? reinterpret_cast<HWND>(underMouse->winId()) : ::GetFocus();
bool starting = false;
for (;;) {