]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/clipbrd.cpp
SetLabel() adjusts the label size
[wxWidgets.git] / src / gtk / clipbrd.cpp
index b5b3c3cec75c8f6ced61fe1f46927207c03af327..9dd96f96b63cf7e1a131cf24cdb8859281bd7bad 100644 (file)
@@ -25,7 +25,6 @@
 
 wxClipboard *wxTheClipboard = (wxClipboard*) NULL;
 
-GdkAtom  g_textAtom        = 0;
 GdkAtom  g_clipboardAtom   = 0;
 GdkAtom  g_targetsAtom     = 0;
 
@@ -75,6 +74,9 @@ targets_selection_received( GtkWidget *WXUNUSED(widget),
 
     for (unsigned int i=0; i<selection_data->length/sizeof(GdkAtom); i++)
     {
+      char *name = gdk_atom_name (atoms[i]);
+      if (name) printf( "Format available: %s.\n", name );
+      
         if (atoms[i] == clipboard->m_targetRequested)
         {
             clipboard->m_formatSupported = TRUE;
@@ -292,7 +294,6 @@ wxClipboard::wxClipboard()
                        (gpointer) NULL );
                      
     if (!g_clipboardAtom) g_clipboardAtom = gdk_atom_intern( "CLIPBOARD", FALSE );
-    if (!g_textAtom) g_textAtom = gdk_atom_intern( "TEXT", FALSE );
     if (!g_targetsAtom) g_targetsAtom = gdk_atom_intern ("TARGETS", FALSE);
   
     m_formatSupported = FALSE;
@@ -382,6 +383,26 @@ bool wxClipboard::AddData( wxDataObject *data )
     
     /* Add handlers if someone requests data */
   
+
+#if (GTK_MINOR_VERSION > 0)
+
+    gtk_selection_add_target( GTK_WIDGET(m_clipboardWidget), 
+                              GDK_SELECTION_PRIMARY,
+                             format, 
+                             0 );  /* what is info ? */
+                            
+    gtk_selection_add_target( GTK_WIDGET(m_clipboardWidget), 
+                              g_clipboardAtom,
+                             format, 
+                             0 );  /* what is info ? */
+                            
+    gtk_signal_connect( GTK_OBJECT(m_clipboardWidget), 
+                        "selection_get",
+                       GTK_SIGNAL_FUNC(selection_handler), 
+                       (gpointer) NULL );
+
+#else
+
     gtk_selection_add_handler( m_clipboardWidget, 
                                g_clipboardAtom,
                               format,
@@ -393,6 +414,7 @@ bool wxClipboard::AddData( wxDataObject *data )
                               format,
                               selection_handler,
                               (gpointer) NULL );
+#endif
                               
     /* Tell the world we offer clipboard data */