~wxClipboardSync()
{
+#if wxUSE_CONSOLE_EVENTLOOP
// ensure that there is a running event loop: this might not be the
// case if we're called before the main event loop startup
wxEventLoopGuarantor ensureEventLoop;
-
+#endif
while (ms_clipboard)
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_CLIPBOARD);
}
if ( !clipboard )
return;
- wxDataObject * const data = clipboard->GTKGetDataObject();
+ wxDataObject * const data = clipboard->GTKGetDataObject(selection_data->selection);
if ( !data )
return;
void wxClipboard::GTKClearData(Kind kind)
{
wxDataObject *&data = Data(kind);
- if ( data )
- {
- delete data;
- data = NULL;
- }
+ wxDELETE(data);
}
bool wxClipboard::SetSelectionOwner(bool set)
{
wxCHECK_MSG( m_open, false, wxT("clipboard not open") );
- // get all supported formats from wxDataObjects
- const size_t count = data.GetFormatCount();
+ // get all supported formats from wxDataObjects: notice that we are setting
+ // the object data, so we need them in "Set" direction
+ const size_t count = data.GetFormatCount(wxDataObject::Set);
wxDataFormatArray formats(new wxDataFormat[count]);
- data.GetAllFormats(formats.get());
+ data.GetAllFormats(formats.get(), wxDataObject::Set);
for ( size_t i = 0; i < count; i++ )
{
return false;
}
+wxDataObject* wxClipboard::GTKGetDataObject( GdkAtom atom )
+{
+ if ( atom == GDK_NONE )
+ return Data();
+
+ if ( atom == GDK_SELECTION_PRIMARY )
+ {
+ wxLogTrace(TRACE_CLIPBOARD, wxT("Primary selection requested" ));
+
+ return Data( wxClipboard::Primary );
+ }
+ else if ( atom == g_clipboardAtom )
+ {
+ wxLogTrace(TRACE_CLIPBOARD, wxT("Clipboard data requested" ));
+
+ return Data( wxClipboard::Clipboard );
+ }
+ else // some other selection, we're not concerned
+ {
+ return (wxDataObject*)NULL;
+ }
+}
+
#endif // wxUSE_CLIPBOARD