Author: gadamopoulos
Date: Wed Feb  1 21:43:20 2017
New Revision: 73664

URL: http://svn.reactos.org/svn/reactos?rev=73664&view=rev
Log:
[SHELL32] -CDefView: Calculate correctly the position of the cursor over the 
icon. Call ImageList_DragEnter only after we are sure that DragEnter will 
succeed.

Modified:
    trunk/reactos/dll/win32/shell32/CDefView.cpp

Modified: trunk/reactos/dll/win32/shell32/CDefView.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CDefView.cpp?rev=73664&r1=73663&r2=73664&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/CDefView.cpp        [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CDefView.cpp        [iso-8859-1] Wed Feb  1 
21:43:20 2017
@@ -1769,7 +1769,7 @@
                     POINT ptItem;
                     m_ListView.GetItemPosition(params->iItem, &ptItem);
 
-                    ImageList_BeginDrag(big_icons, iIcon, m_ptFirstMousePos.x 
- ptItem.x, m_ptFirstMousePos.y - ptItem.y);
+                    ImageList_BeginDrag(big_icons, iIcon, params->ptAction.x - 
ptItem.x, params->ptAction.y - ptItem.y);
 
                     DoDragDrop(pda, this, dwEffect, &dwEffect2);
 
@@ -2940,14 +2940,18 @@
 
 HRESULT WINAPI CDefView::DragEnter(IDataObject *pDataObject, DWORD 
grfKeyState, POINTL pt, DWORD *pdwEffect)
 {
-    POINT ptClient = {pt.x, pt.y};
-    ScreenToClient(&ptClient);
-
     /* Get a hold on the data object for later calls to DragEnter on the 
sub-folders */
     m_pCurDataObject = pDataObject;
 
-    ImageList_DragEnter(m_hWnd, ptClient.x, ptClient.y);
-    return drag_notify_subitem(grfKeyState, pt, pdwEffect);
+    HRESULT hr = drag_notify_subitem(grfKeyState, pt, pdwEffect);    
+    if (SUCCEEDED(hr))
+    {
+        POINT ptClient = {pt.x, pt.y};
+        ScreenToClient(&ptClient);
+        ImageList_DragEnter(m_hWnd, ptClient.x, ptClient.y);
+    }
+
+    return hr;
 }
 
 HRESULT WINAPI CDefView::DragOver(DWORD grfKeyState, POINTL pt, DWORD 
*pdwEffect)


Reply via email to