X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bd3b7e098d6545688eeee0fedd04346173493875..139c5871c91e087972789526ac7e85a5f4e94ece:/src/gtk1/dataobj.cpp

diff --git a/src/gtk1/dataobj.cpp b/src/gtk1/dataobj.cpp
index cae5a43dfb..2b0f4f43ae 100644
--- a/src/gtk1/dataobj.cpp
+++ b/src/gtk1/dataobj.cpp
@@ -16,6 +16,7 @@
 #include "wx/debug.h"
 #include "wx/mstream.h"
 #include "wx/image.h"
+#include "wx/log.h"
 
 #include <gdk/gdk.h>
 
@@ -72,8 +73,12 @@ wxDataFormat::wxDataFormat( NativeFormat format )
 void wxDataFormat::SetType( wxDataFormatId type )
 {
     PrepareFormats();
-    m_type = type;
+    
+    if (type == wxDF_UNICODETEXT)
+       type = wxDF_TEXT;
 
+    m_type = type;
+    
     if (m_type == wxDF_TEXT)
         m_format = g_textAtom;
     else
@@ -95,7 +100,7 @@ wxDataFormatId wxDataFormat::GetType() const
 
 wxString wxDataFormat::GetId() const
 {
-    wxString ret( gdk_atom_name( m_format ) );  // this will convert from ascii to Unicode
+    wxString ret = wxString::FromAscii( gdk_atom_name( m_format ) );
     return ret;
 }
 
@@ -121,7 +126,7 @@ void wxDataFormat::SetId( const wxChar *id )
     PrepareFormats();
     m_type = wxDF_PRIVATE;
     wxString tmp( id );
-    m_format = gdk_atom_intern( wxMBSTRINGCAST tmp.mbc_str(), FALSE );  // what is the string cast for?
+    m_format = gdk_atom_intern( (const char*) tmp.ToAscii(), FALSE ); 
 }
 
 void wxDataFormat::PrepareFormats()
@@ -134,7 +139,11 @@ void wxDataFormat::PrepareFormats()
     //     text/uri-list for file dnd because compatibility is not important
     //     here (with whom?)
     if (!g_textAtom)
+#if wxUSE_UNICODE
+        g_textAtom = gdk_atom_intern( "UTF8_STRING", FALSE );
+#else
         g_textAtom = gdk_atom_intern( "STRING" /* "text/plain" */, FALSE );
+#endif
     if (!g_pngAtom)
         g_pngAtom = gdk_atom_intern( "image/png", FALSE );
     if (!g_fileAtom)
@@ -149,6 +158,11 @@ wxDataObject::wxDataObject()
 {
 }
 
+wxDataObject::~wxDataObject()
+{
+    // dtor is empty but needed for Darwin and AIX -- otherwise it doesn't link
+}
+
 bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction dir) const
 {
     size_t nFormatCount = GetFormatCount(dir);
@@ -358,7 +372,7 @@ void wxBitmapDataObject::DoConvertToPng()
     wxCHECK_RET( wxImage::FindHandler(wxBITMAP_TYPE_PNG) != NULL,
                  wxT("You must call wxImage::AddHandler(new wxPNGHandler); to be able to use clipboard with bitmaps!") );
 
-    wxImage image(m_bitmap);
+    wxImage image = m_bitmap.ConvertToImage();
 
     wxCountingOutputStream count;
     image.SaveFile(count, wxBITMAP_TYPE_PNG);