qualifies for junk */
gtk_drag_finish (context, FALSE, FALSE, time);
+// printf( "no data.\n" );
+
return;
}
if (!m_dragContext) return FALSE;
if (!m_dragWidget) return FALSE;
+/*
+ wxPrintf( _T("format: %s.\n"), format.GetId().c_str() );
+ if (format.GetType() == wxDF_PRIVATE) wxPrintf( _T("private data.\n") );
+ if (format.GetType() == wxDF_TEXT) wxPrintf( _T("text data.\n") );
+*/
+
/* this should trigger an "drag_data_received" event */
gtk_drag_get_data( m_dragWidget,
m_dragContext,
wxTextDataObject data;
if (!GetData( &data )) return FALSE;
- OnDropText( x, y, data.GetText().mbc_str() );
+ OnDropText( x, y, data.GetText() );
return TRUE;
}
guint WXUNUSED(time),
wxDropSource *drop_source )
{
+// printf( "Provide data!\n" );
+
// char *name = gdk_atom_name( selection_data->target );
// if (name) printf( "Format requested: %s.\n", name );
wxDataObject *data_object = (wxDataObject*) node->Data();
if (data_object->GetFormat().GetAtom() == selection_data->target)
{
+// printf( "format found.\n" );
+
size_t data_size = data_object->GetSize();
+
if (data_size > 0)
{
+// printf( "data size: %d.\n", (int)data_size );
+
guchar *buffer = new guchar[data_size];
data_object->WriteData( buffer );
gtk_selection_data_set( selection_data,
selection_data->target,
- 8, /* 8-bit */
+ 8, // 8-bit
buffer,
data_size );
m_waiting = TRUE;
+ GdkAtom atom = gdk_atom_intern( "STRING", FALSE );
+// wxPrintf( _T("atom id: %d.\n"), (int)atom );
+
GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 );
- gtk_target_list_add( target_list, gdk_atom_intern( "STRING", FALSE ), 0, 0 );
+ gtk_target_list_add( target_list, atom, 0, 0 );
GdkEventMotion event;
event.window = m_widget->window;
event.x = x;
event.y = y;
event.state = state;
+ event.time = GDK_CURRENT_TIME;
/* GTK wants to know which button was pressed which caused the dragging */
int button_number = 0;
0,
0 );
- gdk_flush();
-
- while (m_waiting) wxYield();
+ while (m_waiting) gtk_main_iteration();;
}
g_blockEventsOnDrag = FALSE;