- // Add handlers if someone requests data
-
- gtk_selection_add_handler( m_clipboardWidget,
- g_clipboardAtom,
- data->m_formatAtom,
- selection_handler,
- NULL );
-
- gtk_selection_add_handler( m_clipboardWidget,
- GDK_SELECTION_PRIMARY,
- data->m_formatAtom,
- selection_handler,
- NULL );
-
- // Tell the world we offer clipboard data
-
+ /* get formats from wxDataObjects */
+ wxDataFormat *array = new wxDataFormat[ m_data->GetFormatCount() ];
+ m_data->GetAllFormats( array );
+
+ for (size_t i = 0; i < m_data->GetFormatCount(); i++)
+ {
+ GdkAtom atom = array[i];
+ wxLogDebug( wxT("Clipboard Supported atom %s"), gdk_atom_name( atom ) );
+
+ /* Add handlers if someone requests data. We currently always
+ offer data to the clipboard and the primary selection. Maybe
+ we should make that depend on the usePrimary flag */
+
+ gtk_selection_add_target( GTK_WIDGET(m_clipboardWidget),
+ GDK_SELECTION_PRIMARY,
+ atom,
+ 0 ); /* what is info ? */
+
+ gtk_selection_add_target( GTK_WIDGET(m_clipboardWidget),
+ g_clipboardAtom,
+ atom,
+ 0 ); /* what is info ? */
+ }
+
+ delete[] array;
+
+ gtk_signal_connect( GTK_OBJECT(m_clipboardWidget),
+ "selection_get",
+ GTK_SIGNAL_FUNC(selection_handler),
+ (gpointer) NULL );
+
+#if wxUSE_THREADS
+ /* disable GUI threads */
+ wxapp_uninstall_thread_wakeup();
+#endif
+
+ /* Tell the world we offer clipboard data */