https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cd75a87cfd5f78469143d…
commit cd75a87cfd5f78469143df50d947a0cd8f3210ef
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Nov 26 17:34:24 2019 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Nov 26 17:34:24 2019 +0900
[SHELL32] Improve DragEnter of CFSDropTarget (#2073)
Reduce failures of DragDrop testcase. CORE-11238
---
dll/win32/shell32/droptargets/CFSDropTarget.cpp | 42 +++++++++++++++++++++++--
1 file changed, 40 insertions(+), 2 deletions(-)
diff --git a/dll/win32/shell32/droptargets/CFSDropTarget.cpp
b/dll/win32/shell32/droptargets/CFSDropTarget.cpp
index bdf65e1fcc5..b8e67fd9adf 100644
--- a/dll/win32/shell32/droptargets/CFSDropTarget.cpp
+++ b/dll/win32/shell32/droptargets/CFSDropTarget.cpp
@@ -300,7 +300,41 @@ HRESULT WINAPI CFSDropTarget::DragEnter(IDataObject *pDataObject,
m_fAcceptFmt = TRUE;
m_grfKeyState = dwKeyState;
- m_dwDefaultEffect = DROPEFFECT_MOVE;
+
+#define D_NONE DROPEFFECT_NONE
+#define D_COPY DROPEFFECT_COPY
+#define D_MOVE DROPEFFECT_MOVE
+#define D_LINK DROPEFFECT_LINK
+ m_dwDefaultEffect = *pdwEffect;
+ switch (*pdwEffect & (D_COPY | D_MOVE | D_LINK))
+ {
+ case D_COPY | D_MOVE:
+ if (dwKeyState & MK_CONTROL)
+ m_dwDefaultEffect = D_COPY;
+ else
+ m_dwDefaultEffect = D_MOVE;
+ break;
+ case D_COPY | D_MOVE | D_LINK:
+ if ((dwKeyState & (MK_SHIFT | MK_CONTROL)) == (MK_SHIFT | MK_CONTROL))
+ m_dwDefaultEffect = D_LINK;
+ else if ((dwKeyState & (MK_SHIFT | MK_CONTROL)) == MK_CONTROL)
+ m_dwDefaultEffect = D_COPY;
+ else
+ m_dwDefaultEffect = D_MOVE;
+ break;
+ case D_COPY | D_LINK:
+ if ((dwKeyState & (MK_SHIFT | MK_CONTROL)) == (MK_SHIFT | MK_CONTROL))
+ m_dwDefaultEffect = D_LINK;
+ else
+ m_dwDefaultEffect = D_COPY;
+ break;
+ case D_MOVE | D_LINK:
+ if ((dwKeyState & (MK_SHIFT | MK_CONTROL)) == (MK_SHIFT | MK_CONTROL))
+ m_dwDefaultEffect = D_LINK;
+ else
+ m_dwDefaultEffect = D_MOVE;
+ break;
+ }
STGMEDIUM medium;
if (SUCCEEDED(pDataObject->GetData(&fmt2, &medium)))
@@ -317,7 +351,11 @@ HRESULT WINAPI CFSDropTarget::DragEnter(IDataObject *pDataObject,
ReleaseStgMedium(&medium);
}
- _QueryDrop(dwKeyState, pdwEffect);
+ if (!m_fAcceptFmt)
+ *pdwEffect = DROPEFFECT_NONE;
+ else
+ *pdwEffect = m_dwDefaultEffect;
+
return S_OK;
}