+//----------------------------------------------------------------------------
+// "drag_data_get"
+//----------------------------------------------------------------------------
+
+extern "C" {
+static void
+source_drag_data_get (GtkWidget *WXUNUSED(widget),
+ GdkDragContext *WXUNUSED(context),
+ GtkSelectionData *selection_data,
+ guint WXUNUSED(info),
+ guint WXUNUSED(time),
+ wxDropSource *drop_source )
+{
+ if (g_isIdle) wxapp_install_idle_handler();
+
+ wxDataFormat format( selection_data->target );
+
+ wxLogTrace(TRACE_DND, wxT("Drop source: format requested: %s"),
+ format.GetId().c_str());
+
+ drop_source->m_retValue = wxDragCancel;
+
+ wxDataObject *data = drop_source->GetDataObject();
+
+ if (!data)
+ {
+ wxLogTrace(TRACE_DND, wxT("Drop source: no data object") );
+ return;
+ }
+
+ if (!data->IsSupportedFormat(format))
+ {
+ wxLogTrace(TRACE_DND, wxT("Drop source: unsupported format") );
+ return;
+ }
+
+ if (data->GetDataSize(format) == 0)
+ {
+ wxLogTrace(TRACE_DND, wxT("Drop source: empty data") );
+ return;
+ }
+
+ size_t size = data->GetDataSize(format);
+
+// printf( "data size: %d.\n", (int)data_size );
+
+ guchar *d = new guchar[size];
+
+ if (!data->GetDataHere( format, (void*)d ))
+ {
+ delete[] d;
+ return;
+ }
+
+#if wxUSE_THREADS
+ /* disable GUI threads */
+#endif
+
+ gtk_selection_data_set( selection_data,
+ selection_data->target,
+ 8, // 8-bit
+ d,
+ size );
+
+#if wxUSE_THREADS
+ /* enable GUI threads */
+#endif
+
+ delete[] d;
+}
+}
+
+//----------------------------------------------------------------------------
+// "drag_data_delete"
+//----------------------------------------------------------------------------
+
+extern "C" {
+static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
+ GdkDragContext *context,
+ wxDropSource *WXUNUSED(drop_source) )
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ // printf( "Drag source: drag_data_delete\n" );
+}
+}
+
+//----------------------------------------------------------------------------
+// "drag_begin"
+//----------------------------------------------------------------------------
+
+extern "C" {
+static void source_drag_begin( GtkWidget *WXUNUSED(widget),
+ GdkDragContext *WXUNUSED(context),
+ wxDropSource *WXUNUSED(drop_source) )
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ // printf( "Drag source: drag_begin.\n" );
+}
+}
+
+//----------------------------------------------------------------------------
+// "drag_end"
+//----------------------------------------------------------------------------
+
+extern "C" {
+static void source_drag_end( GtkWidget *WXUNUSED(widget),
+ GdkDragContext *WXUNUSED(context),
+ wxDropSource *drop_source )
+{
+ if (g_isIdle) wxapp_install_idle_handler();
+
+ // printf( "Drag source: drag_end.\n" );
+
+ drop_source->m_waiting = false;
+}
+}