+void wxClipboard::GTKOnSelectionReceived(const GtkSelectionData& sel)
+{
+ wxCHECK_RET( m_receivedData, wxT("should be inside GetData()") );
+
+ const wxDataFormat format(sel.target);
+ wxLogTrace(TRACE_CLIPBOARD, wxT("Received selection %s"),
+ format.GetId().c_str());
+
+ if ( !m_receivedData->IsSupportedFormat(format) )
+ return;
+
+ m_receivedData->SetData(format, sel.length, sel.data);
+ m_formatSupported = true;
+}
+
+//-----------------------------------------------------------------------------
+// asynchronous "selection_received" for targets
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static void
+async_targets_selection_received( GtkWidget *WXUNUSED(widget),
+ GtkSelectionData *selection_data,
+ guint32 WXUNUSED(time),
+ wxClipboard *clipboard )
+{
+ if ( !clipboard ) // Assert?
+ return;
+
+ if (!clipboard->m_sink)
+ return;
+
+ wxClipboardEvent *event = new wxClipboardEvent(wxEVT_CLIPBOARD_CHANGED);
+ event->SetEventObject( clipboard );
+
+ if ( !selection_data || selection_data->length <= 0 )
+ {
+ clipboard->m_sink->QueueEvent( event );
+ clipboard->m_sink.Release();