diff --git a/docs/changes.txt b/docs/changes.txt index 173869152d..db7ab86e8a 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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). diff --git a/src/msw/ole/droptgt.cpp b/src/msw/ole/droptgt.cpp index 182ae4e3d0..45b67c3c16 100644 --- a/src/msw/ole/droptgt.cpp +++ b/src/msw/ole/droptgt.cpp @@ -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);