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/branches/WX_3_0_BRANCH@76076 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-03-04 14:07:16 +00:00
parent f388eb6157
commit 3048caa25d
2 changed files with 21 additions and 17 deletions

View File

@@ -617,6 +617,7 @@ wxMSW:
- Disable the use of compiler TLS to avoid mysterious crashes in plugins.
- Added solution files for MSVS 2012 and 2013 (Artur Wieczorek).
- Fix handling of unsupported formats in dnd (jwiesemann).
- Fix blank wxBitmapComboBox dropdown appearance.
- Fix clicking on checkboxes in wxDataViewCtrl.
- Many improvements to alpha transparency handling (Artur Wieczorek).

View File

@@ -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);