[PATCH 1/3 v2] winex11.drv: Send WM_DROPFILES if IDropTarget_Drop failed or DROPEFFECT_NONE was set
Piotr Caban
piotr.caban at gmail.com
Fri Nov 20 06:42:59 CST 2015
Hi Damjan,
On 11/20/15 11:43, Piotr Caban wrote:
> With these patches OLE Drag&Drop still doesn't behave exactly the same
> as on Windows. E.g. IDropTarget::* failures or DROPEFFECT_NONE are
> handled incorrectly in some places. I'm planning to send more patches
> after code freeze.
Here are the patches I'm planning to send after the code freeze
(generated on top of this series).
Thanks,
Piotr
-------------- next part --------------
>From d19fc541953f9f58aaa5505fc83d2a59a410159d Mon Sep 17 00:00:00 2001
From: Piotr Caban <piotr at codeweavers.com>
Date: Fri, 20 Nov 2015 12:18:46 +0100
Subject: [PATCH 1/5] winex11.drv: Ignore effect returned in
IDropTarget::DragEnter
To: wine-patches <wine-patches at winehq.org>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
---
dlls/winex11.drv/xdnd.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c
index 01af480..b066751 100644
--- a/dlls/winex11.drv/xdnd.c
+++ b/dlls/winex11.drv/xdnd.c
@@ -305,17 +305,13 @@ void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event )
XDNDLastDropTargetWnd = dropTargetWindow;
if (dropTarget)
{
+ DWORD effect_ignore = effect;
hr = IDropTarget_DragEnter(dropTarget, &XDNDDataObject,
MK_LBUTTON, pointl, &effect);
- if (SUCCEEDED(hr))
+ if (hr == S_OK)
{
- if (effect != DROPEFFECT_NONE)
- {
- XDNDAccepted = TRUE;
- TRACE("the application accepted the drop\n");
- }
- else
- TRACE("the application refused the drop\n");
+ XDNDAccepted = TRUE;
+ TRACE("the application accepted the drop (effect = %d)\n", effect_ignore);
}
else
WARN("IDropTarget_DragEnter failed, error 0x%08X\n", hr);
@@ -340,7 +336,7 @@ void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event )
if (XDNDAccepted)
accept = 1;
else if ((GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES) &&
- (X11DRV_XDND_XdndActionToDROPEFFECT(event->data.l[4]) & DROPEFFECT_COPY) &&
+ (effect & DROPEFFECT_COPY) &&
X11DRV_XDND_HasHDROP())
{
accept = 1;
--
2.4.10
-------------- next part --------------
>From 3e7e1dbbc0e204204f3f92be24908d8cd4b7b136 Mon Sep 17 00:00:00 2001
From: Piotr Caban <piotr at codeweavers.com>
Date: Fri, 20 Nov 2015 12:39:42 +0100
Subject: [PATCH 2/5] winex11.drv: Call DragLeave instead of Drop if
DROPEFFECT_NONE was set
To: wine-patches <wine-patches at winehq.org>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
---
dlls/winex11.drv/xdnd.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c
index b066751..d5881ad 100644
--- a/dlls/winex11.drv/xdnd.c
+++ b/dlls/winex11.drv/xdnd.c
@@ -386,7 +386,7 @@ void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event )
if (XDNDAccepted)
{
dropTarget = get_droptarget_pointer(XDNDLastDropTargetWnd);
- if (dropTarget)
+ if (dropTarget && effect!=DROPEFFECT_NONE)
{
HRESULT hr;
POINTL pointl;
@@ -415,6 +415,13 @@ void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event )
}
IDropTarget_Release(dropTarget);
}
+ else if (dropTarget)
+ {
+ HRESULT hr = IDropTarget_DragLeave(dropTarget);
+ if (FAILED(hr))
+ WARN("IDropTarget_DragLeave failed, error 0x%08X\n", hr);
+ IDropTarget_Release(dropTarget);
+ }
}
if (drop_file)
--
2.4.10
-------------- next part --------------
>From 372af0ec1e87d6f7650f7df7029b7109cd5f78fd Mon Sep 17 00:00:00 2001
From: Piotr Caban <piotr at codeweavers.com>
Date: Fri, 20 Nov 2015 12:42:07 +0100
Subject: [PATCH 3/5] winex11.drv: Only update drop effect if
IDropTarget::DragOver returned S_OK
To: wine-patches <wine-patches at winehq.org>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
---
dlls/winex11.drv/xdnd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c
index d5881ad..841eaff 100644
--- a/dlls/winex11.drv/xdnd.c
+++ b/dlls/winex11.drv/xdnd.c
@@ -325,7 +325,7 @@ void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event )
if (dropTarget)
{
hr = IDropTarget_DragOver(dropTarget, MK_LBUTTON, pointl, &effect);
- if (SUCCEEDED(hr))
+ if (hr != S_OK)
XDNDDropEffect = effect;
else
WARN("IDropTarget_DragOver failed, error 0x%08X\n", hr);
--
2.4.10
-------------- next part --------------
>From 345f824a354544c514f2958acb8153a5ca22039d Mon Sep 17 00:00:00 2001
From: Piotr Caban <piotr at codeweavers.com>
Date: Fri, 20 Nov 2015 13:01:55 +0100
Subject: [PATCH 4/5] winex11.drv: Reset XDNDAccepted flag if
IDropTarget::DragEnter fails
To: wine-patches <wine-patches at winehq.org>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
---
dlls/winex11.drv/xdnd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c
index 841eaff..0c34b4f 100644
--- a/dlls/winex11.drv/xdnd.c
+++ b/dlls/winex11.drv/xdnd.c
@@ -314,7 +314,10 @@ void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event )
TRACE("the application accepted the drop (effect = %d)\n", effect_ignore);
}
else
+ {
+ XDNDAccepted = FALSE;
WARN("IDropTarget_DragEnter failed, error 0x%08X\n", hr);
+ }
IDropTarget_Release(dropTarget);
}
}
--
2.4.10
-------------- next part --------------
>From 7f3674565f025a0ea6c4486ce19e2a31fc3b4fb1 Mon Sep 17 00:00:00 2001
From: Piotr Caban <piotr at codeweavers.com>
Date: Fri, 20 Nov 2015 13:18:05 +0100
Subject: [PATCH 5/5] winex11.drv: XDNDDropEffect stores OLE Drag&Drop effect
so don't use it WS_EX_ACCEPTFILES related drops
To: wine-patches <wine-patches at winehq.org>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
---
dlls/winex11.drv/xdnd.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c
index 0c34b4f..8b2c582 100644
--- a/dlls/winex11.drv/xdnd.c
+++ b/dlls/winex11.drv/xdnd.c
@@ -339,12 +339,10 @@ void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event )
if (XDNDAccepted)
accept = 1;
else if ((GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES) &&
- (effect & DROPEFFECT_COPY) &&
X11DRV_XDND_HasHDROP())
{
accept = 1;
effect = DROPEFFECT_COPY;
- XDNDDropEffect = effect;
}
TRACE("action req: %ld accept(%d) at x(%d),y(%d)\n",
@@ -432,7 +430,6 @@ void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event )
/* 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) &&
- (XDNDDropEffect & DROPEFFECT_COPY) &&
X11DRV_XDND_HasHDROP())
{
HRESULT hr = X11DRV_XDND_SendDropFiles( hWnd );
--
2.4.10
More information about the wine-devel
mailing list