Don't accept data in unsupported format in wxMSW dnd code.
We wrongly pretended to accept the data in formats which we didn't actually accept and showed misleading cursors to the user. Fix this by partially reverting some of the changes of r72668 (see #14697). Closes #16042. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76078 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
a46fbf1bcd
commit
e2fe8927cc
@ -218,6 +218,16 @@ STDMETHODIMP wxIDropTarget::DragEnter(IDataObject *pIDataSource,
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
if ( !m_pTarget->MSWIsAcceptedData(pIDataSource) ) {
|
||||
// we don't accept this kind of data
|
||||
*pdwEffect = DROPEFFECT_NONE;
|
||||
|
||||
// Don't do anything else if we don't support this format at all, notably
|
||||
// don't call our OnEnter() below which would show misleading cursor to
|
||||
// the user.
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// for use in OnEnter and OnDrag calls
|
||||
m_pTarget->MSWSetDataSource(pIDataSource);
|
||||
|
||||
@ -225,26 +235,19 @@ STDMETHODIMP wxIDropTarget::DragEnter(IDataObject *pIDataSource,
|
||||
m_pIDataObject = pIDataSource;
|
||||
m_pIDataObject->AddRef();
|
||||
|
||||
if ( !m_pTarget->MSWIsAcceptedData(pIDataSource) ) {
|
||||
// we don't accept this kind of data
|
||||
*pdwEffect = DROPEFFECT_NONE;
|
||||
}
|
||||
else
|
||||
// we need client coordinates to pass to wxWin functions
|
||||
if ( !ScreenToClient(m_hwnd, (POINT *)&pt) )
|
||||
{
|
||||
// we need client coordinates to pass to wxWin functions
|
||||
if ( !ScreenToClient(m_hwnd, (POINT *)&pt) )
|
||||
{
|
||||
wxLogLastError(wxT("ScreenToClient"));
|
||||
}
|
||||
|
||||
// give some visual feedback
|
||||
*pdwEffect = ConvertDragResultToEffect(
|
||||
m_pTarget->OnEnter(pt.x, pt.y, ConvertDragEffectToResult(
|
||||
GetDropEffect(grfKeyState, m_pTarget->GetDefaultAction(), *pdwEffect))
|
||||
)
|
||||
);
|
||||
wxLogLastError(wxT("ScreenToClient"));
|
||||
}
|
||||
|
||||
// give some visual feedback
|
||||
*pdwEffect = ConvertDragResultToEffect(
|
||||
m_pTarget->OnEnter(pt.x, pt.y, ConvertDragEffectToResult(
|
||||
GetDropEffect(grfKeyState, m_pTarget->GetDefaultAction(), *pdwEffect))
|
||||
)
|
||||
);
|
||||
|
||||
// update drag image
|
||||
const wxDragResult res = ConvertDragEffectToResult(*pdwEffect);
|
||||
m_pTarget->MSWUpdateDragImageOnEnter(pt.x, pt.y, res);
|
||||
|
Loading…
Reference in New Issue
Block a user