static void doMouseMove(MSG msg) { COMPtr<IWebFramePrivate> framePrivate; if (SUCCEEDED(frame->QueryInterface(&framePrivate))) framePrivate->layout(); dispatchMessage(&msg); if (down && draggingInfo) { POINT screenPoint = msg.pt; ::ClientToScreen(webViewWindow, &screenPoint); IWebView* webView; COMPtr<IDropTarget> webViewDropTarget; if (SUCCEEDED(frame->webView(&webView)) && SUCCEEDED(webView->QueryInterface(IID_IDropTarget, (void**)&webViewDropTarget))) { DWORD effect = 0; if (didDragEnter) webViewDropTarget->DragOver(MK_LBUTTON, pointl(screenPoint), &effect); else { webViewDropTarget->DragEnter(draggingInfo->dataObject(), 0, pointl(screenPoint), &effect); didDragEnter = true; } draggingInfo->dropSource()->GiveFeedback(effect); } } }
static void doMouseUp(MSG msg) { COMPtr<IWebFramePrivate> framePrivate; if (SUCCEEDED(frame->QueryInterface(&framePrivate))) framePrivate->layout(); dispatchMessage(&msg); down = false; if (draggingInfo) { COMPtr<IWebView> webView; COMPtr<IDropTarget> webViewDropTarget; if (SUCCEEDED(frame->webView(&webView)) && SUCCEEDED(webView->QueryInterface(IID_IDropTarget, (void**)&webViewDropTarget))) { POINT screenPoint = msg.pt; ::ClientToScreen(webViewWindow, &screenPoint); HRESULT hr = draggingInfo->dropSource()->QueryContinueDrag(0, 0); DWORD effect = 0; webViewDropTarget->DragOver(0, pointl(screenPoint), &effect); if (hr == DRAGDROP_S_DROP && effect != DROPEFFECT_NONE) { DWORD effect = 0; webViewDropTarget->Drop(draggingInfo->dataObject(), 0, pointl(screenPoint), &effect); } else webViewDropTarget->DragLeave(); delete draggingInfo; draggingInfo = 0; } } }
static void doMouseUp(MSG msg, HRESULT* oleDragAndDropReturnValue = 0) { COMPtr<IWebFramePrivate> framePrivate; if (SUCCEEDED(frame->QueryInterface(&framePrivate))) framePrivate->layout(); dispatchMessage(&msg); down = false; if (draggingInfo) { COMPtr<IWebView> webView; COMPtr<IDropTarget> webViewDropTarget; if (SUCCEEDED(frame->webView(&webView)) && SUCCEEDED(webView->QueryInterface(IID_IDropTarget, (void**)&webViewDropTarget))) { POINT screenPoint = msg.pt; DWORD effect = 0; ::ClientToScreen(webViewWindow, &screenPoint); if (!didDragEnter) { webViewDropTarget->DragEnter(draggingInfo->dataObject(), 0, pointl(screenPoint), &effect); didDragEnter = true; } HRESULT hr = draggingInfo->dropSource()->QueryContinueDrag(0, 0); if (oleDragAndDropReturnValue) *oleDragAndDropReturnValue = hr; webViewDropTarget->DragOver(0, pointl(screenPoint), &effect); if (hr == DRAGDROP_S_DROP && effect != DROPEFFECT_NONE) { DWORD effect = 0; webViewDropTarget->Drop(draggingInfo->dataObject(), 0, pointl(screenPoint), &effect); draggingInfo->setPerformedDropEffect(effect); } else webViewDropTarget->DragLeave(); // Reset didDragEnter so that another drag started within the same frame works properly. didDragEnter = false; } } }