X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/28f92d74ee73176fc391fb8c3de75c76dd086319..3e603cb7139e8b936f5704bccfc48fd25581d7cb:/src/msw/clipbrd.cpp diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index ee67b677fd..b9df0c2767 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -547,6 +547,9 @@ wxClipboard::~wxClipboard() void wxClipboard::Clear() { + if ( IsUsingPrimarySelection() ) + return; + #if wxUSE_OLE_CLIPBOARD if (m_lastDataObject) { @@ -555,10 +558,10 @@ void wxClipboard::Clear() if (S_OK == hr) { hr = OleSetClipboard(NULL); - if ( FAILED(hr) ) - { - wxLogApiError(wxT("OleSetClipboard(NULL)"), hr); - } + if ( FAILED(hr) ) + { + wxLogApiError(wxT("OleSetClipboard(NULL)"), hr); + } } m_lastDataObject = NULL; } @@ -576,14 +579,14 @@ bool wxClipboard::Flush() if (S_OK == hr) { hr = OleFlushClipboard(); - if ( FAILED(hr) ) - { - wxLogApiError(wxT("OleFlushClipboard"), hr); + if ( FAILED(hr) ) + { + wxLogApiError(wxT("OleFlushClipboard"), hr); - return false; - } - return true; - } + return false; + } + return true; + } } return false; #else // !wxUSE_OLE_CLIPBOARD @@ -613,6 +616,9 @@ bool wxClipboard::IsOpened() const bool wxClipboard::SetData( wxDataObject *data ) { + if ( IsUsingPrimarySelection() ) + return false; + #if !wxUSE_OLE_CLIPBOARD (void)wxEmptyClipboard(); #endif // wxUSE_OLE_CLIPBOARD @@ -625,6 +631,9 @@ bool wxClipboard::SetData( wxDataObject *data ) bool wxClipboard::AddData( wxDataObject *data ) { + if ( IsUsingPrimarySelection() ) + return false; + wxCHECK_MSG( data, false, wxT("data is invalid") ); #if wxUSE_OLE_CLIPBOARD @@ -718,11 +727,14 @@ void wxClipboard::Close() bool wxClipboard::IsSupported( const wxDataFormat& format ) { - return wxIsClipboardFormatAvailable(format); + return !IsUsingPrimarySelection() && wxIsClipboardFormatAvailable(format); } bool wxClipboard::GetData( wxDataObject& data ) { + if ( IsUsingPrimarySelection() ) + return false; + #if wxUSE_OLE_CLIPBOARD IDataObject *pDataObject = NULL; HRESULT hr = OleGetClipboard(&pDataObject); @@ -758,7 +770,7 @@ bool wxClipboard::GetData( wxDataObject& data ) // enumerate all explicit formats on the clipboard. // note that this does not include implicit / synthetic (automatically // converted) formats. -#ifdef __WXDEBUG__ +#if wxDEBUG_LEVEL >= 2 // get the format enumerator IEnumFORMATETC *pEnumFormatEtc = NULL; hr = pDataObject->EnumFormatEtc(DATADIR_GET, &pEnumFormatEtc); @@ -791,7 +803,7 @@ bool wxClipboard::GetData( wxDataObject& data ) pEnumFormatEtc->Release(); } -#endif // Debug +#endif // wxDEBUG_LEVEL >= 2 STGMEDIUM medium; // stop at the first valid format found on the clipboard