From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Sat, 28 Jun 2008 01:40:42 +0000 (+0000)
Subject: don't call OnData() if OnEnter() rejected the drag (#9634)
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4095fb14c4c25c976088bc6f0339fa339b51edd6?ds=sidebyside

don't call OnData() if OnEnter() rejected the drag (#9634)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54398 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/src/msw/ole/droptgt.cpp b/src/msw/ole/droptgt.cpp
index 4601d19be4..3ca2761733 100644
--- a/src/msw/ole/droptgt.cpp
+++ b/src/msw/ole/droptgt.cpp
@@ -244,15 +244,20 @@ STDMETHODIMP wxIDropTarget::DragOver(DWORD   grfKeyState,
         result = wxDragNone;
     }
 
-    // we need client coordinates to pass to wxWin functions
-    if ( !ScreenToClient(m_hwnd, (POINT *)&pt) )
-    {
-        wxLogLastError(wxT("ScreenToClient"));
-    }
+    if ( result != wxDragNone ) {
+        // we need client coordinates to pass to wxWin functions
+        if ( !ScreenToClient(m_hwnd, (POINT *)&pt) )
+        {
+            wxLogLastError(wxT("ScreenToClient"));
+        }
 
-    *pdwEffect = ConvertDragResultToEffect(
-                    m_pTarget->OnDragOver(pt.x, pt.y, result)
-                 );
+        *pdwEffect = ConvertDragResultToEffect(
+                        m_pTarget->OnDragOver(pt.x, pt.y, result)
+                     );
+    }
+    else {
+        *pdwEffect = DROPEFFECT_NONE;
+    }
 
     return S_OK;
 }