Piotr Caban : winex11.drv: Don't call IDropTarget::{DragOver, DragLeave, Drop} functions if DragEnter fails.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Nov 20 07:48:47 CST 2015


Module: wine
Branch: master
Commit: a19fe8d9c8547f803ac953e705d1a937e00719c3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a19fe8d9c8547f803ac953e705d1a937e00719c3

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Fri Nov 20 11:44:26 2015 +0100

winex11.drv: Don't call IDropTarget::{DragOver,DragLeave,Drop} functions if DragEnter fails.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winex11.drv/xdnd.c | 66 +++++++++++++++++++++++++++----------------------
 1 file changed, 36 insertions(+), 30 deletions(-)

diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c
index 59c1671..01af480 100644
--- a/dlls/winex11.drv/xdnd.c
+++ b/dlls/winex11.drv/xdnd.c
@@ -285,7 +285,7 @@ void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event )
         /* Notify OLE of DragEnter. Result determines if we accept */
         HWND dropTargetWindow;
 
-        if (XDNDLastDropTargetWnd)
+        if (XDNDAccepted && XDNDLastDropTargetWnd)
         {
             dropTarget = get_droptarget_pointer(XDNDLastDropTargetWnd);
             if (dropTarget)
@@ -387,35 +387,38 @@ void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event )
     TRACE("\n");
 
     /* Notify OLE of Drop */
-    dropTarget = get_droptarget_pointer(XDNDLastDropTargetWnd);
-    if (dropTarget)
+    if (XDNDAccepted)
     {
-        HRESULT hr;
-        POINTL pointl;
-
-        pointl.x = XDNDxy.x;
-        pointl.y = XDNDxy.y;
-        hr = IDropTarget_Drop(dropTarget, &XDNDDataObject, MK_LBUTTON,
-                              pointl, &effect);
-        if (hr == S_OK)
+        dropTarget = get_droptarget_pointer(XDNDLastDropTargetWnd);
+        if (dropTarget)
         {
-            if (effect != DROPEFFECT_NONE)
+            HRESULT hr;
+            POINTL pointl;
+
+            pointl.x = XDNDxy.x;
+            pointl.y = XDNDxy.y;
+            hr = IDropTarget_Drop(dropTarget, &XDNDDataObject, MK_LBUTTON,
+                                  pointl, &effect);
+            if (hr == S_OK)
             {
-                TRACE("drop succeeded\n");
-                accept = 1;
-                drop_file = FALSE;
+                if (effect != DROPEFFECT_NONE)
+                {
+                    TRACE("drop succeeded\n");
+                    accept = 1;
+                    drop_file = FALSE;
+                }
+                else
+                    TRACE("the application refused the drop\n");
             }
+            else if (FAILED(hr))
+                WARN("drop failed, error 0x%08X\n", hr);
             else
-                TRACE("the application refused the drop\n");
-        }
-        else if (FAILED(hr))
-            WARN("drop failed, error 0x%08X\n", hr);
-        else
-        {
-            WARN("drop returned 0x%08X\n", hr);
-            drop_file = FALSE;
+            {
+                WARN("drop returned 0x%08X\n", hr);
+                drop_file = FALSE;
+            }
+            IDropTarget_Release(dropTarget);
         }
-        IDropTarget_Release(dropTarget);
     }
 
     if (drop_file)
@@ -465,13 +468,16 @@ void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event )
     TRACE("DND Operation canceled\n");
 
     /* Notify OLE of DragLeave */
-    dropTarget = get_droptarget_pointer(XDNDLastDropTargetWnd);
-    if (dropTarget)
+    if (XDNDAccepted)
     {
-        HRESULT hr = IDropTarget_DragLeave(dropTarget);
-        if (FAILED(hr))
-            WARN("IDropTarget_DragLeave failed, error 0x%08X\n", hr);
-        IDropTarget_Release(dropTarget);
+        dropTarget = get_droptarget_pointer(XDNDLastDropTargetWnd);
+        if (dropTarget)
+        {
+            HRESULT hr = IDropTarget_DragLeave(dropTarget);
+            if (FAILED(hr))
+                WARN("IDropTarget_DragLeave failed, error 0x%08X\n", hr);
+            IDropTarget_Release(dropTarget);
+        }
     }
 
     X11DRV_XDND_FreeDragDropOp();




More information about the wine-cvs mailing list