shell32: Respect the drop effect in do_paste().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=34322
This commit is contained in:
parent
a415874f59
commit
e5afb283cf
2 changed files with 19 additions and 20 deletions
|
@ -409,6 +409,7 @@ static WCHAR *build_source_paths(ITEMIDLIST *root_pidl, ITEMIDLIST **pidls, unsi
|
|||
static HRESULT do_paste(ContextMenu *menu, HWND hwnd)
|
||||
{
|
||||
IPersistFolder2 *dst_persist;
|
||||
const DWORD *drop_effect;
|
||||
IShellFolder *dst_folder;
|
||||
WCHAR dst_path[MAX_PATH];
|
||||
SHFILEOPSTRUCTW op = {0};
|
||||
|
@ -456,13 +457,27 @@ static HRESULT do_paste(ContextMenu *menu, HWND hwnd)
|
|||
ILFree(dst_pidl);
|
||||
|
||||
op.hwnd = hwnd;
|
||||
op.wFunc = FO_COPY;
|
||||
op.pTo = dst_path;
|
||||
op.fFlags = FOF_ALLOWUNDO;
|
||||
|
||||
if (FAILED(hr = OleGetClipboard(&data)))
|
||||
return hr;
|
||||
|
||||
if (FAILED(hr = get_data_format(data, RegisterClipboardFormatW(CFSTR_PREFERREDDROPEFFECTW), &medium)))
|
||||
{
|
||||
ERR("Failed to get drop effect.\n");
|
||||
IDataObject_Release(data);
|
||||
return hr;
|
||||
}
|
||||
drop_effect = GlobalLock(medium.hGlobal);
|
||||
if (*drop_effect & DROPEFFECT_COPY)
|
||||
op.wFunc = FO_COPY;
|
||||
else if (*drop_effect & DROPEFFECT_MOVE)
|
||||
op.wFunc = FO_MOVE;
|
||||
else
|
||||
FIXME("Unhandled drop effect %#lx.\n", *drop_effect);
|
||||
GlobalUnlock(medium.hGlobal);
|
||||
|
||||
if (SUCCEEDED(get_data_format(data, RegisterClipboardFormatW(CFSTR_SHELLIDLISTW), &medium)))
|
||||
{
|
||||
const CIDA *cida = GlobalLock(medium.hGlobal);
|
||||
|
|
|
@ -5890,14 +5890,7 @@ static void test_copy_paste(void)
|
|||
|
||||
format.cfFormat = RegisterClipboardFormatW(CFSTR_PREFERREDDROPEFFECTW);
|
||||
hr = IDataObject_GetData(data_obj, &format, &medium);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
effect = GlobalLock(medium.hGlobal);
|
||||
ok(*effect == DROPEFFECT_MOVE, "Got effect %#lx.\n", *effect);
|
||||
GlobalUnlock(medium.hGlobal);
|
||||
ReleaseStgMedium(&medium);
|
||||
}
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
|
||||
IDataObject_Release(data_obj);
|
||||
|
||||
|
@ -5913,9 +5906,7 @@ static void test_copy_paste(void)
|
|||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
|
||||
ret = MoveFileExW(L"testcopy_dst/testcopy_src", L"testcopy_src", 0);
|
||||
todo_wine ok(ret, "Got error %lu.\n", GetLastError());
|
||||
if (!ret && GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
RemoveDirectoryW(L"testcopy_dst/testcopy_src");
|
||||
ok(ret, "Got error %lu.\n", GetLastError());
|
||||
|
||||
/* Copy. */
|
||||
|
||||
|
@ -5933,14 +5924,7 @@ static void test_copy_paste(void)
|
|||
|
||||
format.cfFormat = RegisterClipboardFormatW(CFSTR_PREFERREDDROPEFFECTW);
|
||||
hr = IDataObject_GetData(data_obj, &format, &medium);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
effect = GlobalLock(medium.hGlobal);
|
||||
ok(*effect == (DROPEFFECT_COPY | DROPEFFECT_LINK), "Got effect %#lx.\n", *effect);
|
||||
GlobalUnlock(medium.hGlobal);
|
||||
ReleaseStgMedium(&medium);
|
||||
}
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
|
||||
IDataObject_Release(data_obj);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue