+#if wxCHECK_LESSTIF()
+void wxClipboardCallback( Widget xwidget, int* data_id,
+ int* priv, int* WXUNUSED(reason) )
+#else
+void wxClipboardCallback( Widget xwidget, long* data_id,
+ long* priv, int* WXUNUSED(reason) )
+#endif
+{
+ Display* xdisplay = XtDisplay( xwidget );
+ Window xwindow = XtWindow( xwidget );
+ wxDataObject* dobj = NULL;
+ size_t size = 0;
+
+ for( wxDataIdToDataObjectList::compatibility_iterator node2 =
+ wxTheClipboard->m_idToObject.GetFirst();
+ node2; node2 = node2->GetNext() )
+ {
+ wxDataIdToDataObject* dido = node2->GetData();
+ if( dido->dataId == *data_id )
+ {
+ dobj = dido->object;
+ size = dido->size;
+ break;
+ }
+ }
+
+ if( !dobj ) return;
+
+ wxCharBuffer buffer(size);
+ size_t count = dobj->GetFormatCount( wxDataObject::Get );
+ wxDataFormatScopedArray dfarr( new wxDataFormat[count] );
+ dobj->GetAllFormats( dfarr.get(), wxDataObject::Get );
+
+ if( !dobj->GetDataHere( dfarr[*priv], buffer.data() ) )
+ return;
+
+ while( XmClipboardCopyByName( xdisplay, xwindow, *data_id,
+ buffer.data(), size, 0 )
+ == XmClipboardLocked );
+}