winex11.drv: Send WM_DROPFILES if IDropTarget_Drop failed or DROPEFFECT_NONE was set.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2015-11-20 11:43:38 +01:00 committed by Alexandre Julliard
parent eafdbdd13b
commit 5dad16510d
1 changed files with 14 additions and 6 deletions

View File

@ -383,6 +383,7 @@ void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event )
IDropTarget *dropTarget; IDropTarget *dropTarget;
DWORD effect = XDNDDropEffect; DWORD effect = XDNDDropEffect;
int accept = 0; /* Assume we're not accepting */ int accept = 0; /* Assume we're not accepting */
BOOL drop_file = TRUE;
TRACE("\n"); TRACE("\n");
@ -397,26 +398,33 @@ void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event )
pointl.y = XDNDxy.y; pointl.y = XDNDxy.y;
hr = IDropTarget_Drop(dropTarget, &XDNDDataObject, MK_LBUTTON, hr = IDropTarget_Drop(dropTarget, &XDNDDataObject, MK_LBUTTON,
pointl, &effect); pointl, &effect);
if (SUCCEEDED(hr)) if (hr == S_OK)
{ {
if (effect != DROPEFFECT_NONE) if (effect != DROPEFFECT_NONE)
{ {
TRACE("drop succeeded\n"); TRACE("drop succeeded\n");
accept = 1; accept = 1;
drop_file = FALSE;
} }
else else
TRACE("the application refused the drop\n"); TRACE("the application refused the drop\n");
} }
else else if (FAILED(hr))
WARN("drop failed, error 0x%08X\n", hr); WARN("drop failed, error 0x%08X\n", hr);
IDropTarget_Release(dropTarget);
}
else else
{ {
/* Only send WM_DROPFILES if there is no drop target. Doing both WARN("drop returned 0x%08X\n", hr);
* causes winamp to duplicate the dropped files (#29081) */ drop_file = FALSE;
}
IDropTarget_Release(dropTarget);
}
if (drop_file)
{
/* Only send WM_DROPFILES if Drop didn't succeed or DROPEFFECT_NONE was set.
* Doing both causes winamp to duplicate the dropped files (#29081) */
if ((GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES) && if ((GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES) &&
(effect & DROPEFFECT_COPY) && (XDNDDropEffect & DROPEFFECT_COPY) &&
X11DRV_XDND_HasHDROP()) X11DRV_XDND_HasHDROP())
{ {
HRESULT hr = X11DRV_XDND_SendDropFiles( hWnd ); HRESULT hr = X11DRV_XDND_SendDropFiles( hWnd );