+ m_data.Append( data );
+
+ Display* xdisplay = wxGlobalDisplay();
+ Widget xwidget = (Widget)wxTheApp->GetTopLevelWidget();
+ Window xwindow = XtWindow( xwidget );
+ wxXmString label( wxTheApp->GetAppName() );
+ Time timestamp = XtLastTimestampProcessed( xdisplay );
+ long itemId;
+
+ int retval;
+
+ while( ( retval = XmClipboardStartCopy( xdisplay, xwindow, label(),
+ timestamp, xwidget,
+ wxClipboardCallback,
+ &itemId ) )
+ == XmClipboardLocked );
+ if( retval != XmClipboardSuccess )
+ return false;
+
+ size_t count = data->GetFormatCount( wxDataObject::Get );
+ wxDataFormatScopedArray dfarr( new wxDataFormat[count] );
+ data->GetAllFormats( dfarr.get(), wxDataObject::Get );
+
+ for( size_t i = 0; i < count; ++i )
+ {
+ size_t size = data->GetDataSize( dfarr[i] );
+ long data_id;
+ wxString id = dfarr[i].GetId();
+
+ while( ( retval = XmClipboardCopy( xdisplay, xwindow, itemId,
+ wxConstCast(id.c_str(), char),
+ NULL, size, i, &data_id ) )
+ == XmClipboardLocked );
+
+ m_idToObject.Append( new wxDataIdToDataObject( data, data_id, size ) );
+ }
+
+ while( XmClipboardEndCopy( xdisplay, xwindow, itemId )
+ == XmClipboardLocked );
+
+ return true;