[SHELL32]
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Sat, 23 Jul 2016 08:42:38 +0000 (08:42 +0000)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Sat, 23 Jul 2016 08:42:38 +0000 (08:42 +0000)
- CDefView: Add the skeleton check that should be used to implement moving items in the CDefView. Nothing more is implemented because GetKeyState is completely unreliable.

svn path=/trunk/; revision=71979

reactos/dll/win32/shell32/CDefView.cpp

index 86f73b4..6e4c47c 100644 (file)
@@ -97,6 +97,7 @@ class CDefView :
         DWORD                     m_dwAdvf;
         CComPtr<IAdviseSink>      m_pAdvSink;
         // for drag and drop
+        CComPtr<IDataObject>      m_pSourceDataObject;
         CComPtr<IDropTarget>      m_pCurDropTarget;     /* The sub-item, which is currently dragged over */
         CComPtr<IDataObject>      m_pCurDataObject;     /* The dragged data-object */
         LONG                      m_iDragOverItem;      /* Dragged over item's index, iff m_pCurDropTarget != NULL */
@@ -1786,7 +1787,12 @@ LRESULT CDefView::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandl
                     }
 
                     DWORD dwEffect2;
+
+                    m_pSourceDataObject = pda;
+
                     DoDragDrop(pda, this, dwEffect, &dwEffect2);
+
+                    m_pSourceDataObject.Release();
                 }
             }
             break;
@@ -2937,7 +2943,23 @@ HRESULT WINAPI CDefView::DragLeave()
 
 HRESULT WINAPI CDefView::Drop(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
 {
-    if (m_pCurDropTarget)
+    ERR("GetKeyState(VK_LBUTTON): %d\n", GetKeyState(VK_LBUTTON));
+
+    if ((m_iDragOverItem == -1) && 
+        (*pdwEffect & DROPEFFECT_MOVE) && 
+        (GetKeyState(VK_LBUTTON) != 0) &&
+        (m_pSourceDataObject.p) && 
+        (SHIsSameObject(pDataObject, m_pSourceDataObject)))
+    {
+        ERR("Should implement moving items here!\n");
+
+        if (m_pCurDropTarget)
+        {
+            m_pCurDropTarget->DragLeave();
+            m_pCurDropTarget.Release();
+        }
+    }
+    else if (m_pCurDropTarget)
     {
         m_pCurDropTarget->Drop(pDataObject, grfKeyState, pt, pdwEffect);
         m_pCurDropTarget.Release();