Comitted GTK part of clipboard patch, that

enables non-unicode strings to be seen in
    Unicode apps. This is relevant since KDE
    apps paste non-Unicode text.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2004-03-15 22:46:48 +00:00
parent c19bd0a37a
commit c7d6d88330
8 changed files with 133 additions and 37 deletions

View File

@@ -28,6 +28,7 @@
//-------------------------------------------------------------------------
GdkAtom g_textAtom = 0;
GdkAtom g_altTextAtom = 0;
GdkAtom g_pngAtom = 0;
GdkAtom g_fileAtom = 0;
@@ -77,12 +78,9 @@ void wxDataFormat::SetType( wxDataFormatId type )
{
PrepareFormats();
if (type == wxDF_UNICODETEXT)
type = wxDF_TEXT;
m_type = type;
if (m_type == wxDF_TEXT)
if (m_type == wxDF_TEXT || m_type == wxDF_UNICODETEXT)
m_format = g_textAtom;
else
if (m_type == wxDF_BITMAP)
@@ -144,6 +142,7 @@ void wxDataFormat::PrepareFormats()
if (!g_textAtom)
#if wxUSE_UNICODE
g_textAtom = gdk_atom_intern( "UTF8_STRING", FALSE );
g_altTextAtom = gdk_atom_intern( "STRING", FALSE );
#else
g_textAtom = gdk_atom_intern( "STRING" /* "text/plain" */, FALSE );
#endif
@@ -192,6 +191,18 @@ bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction dir)
}
}
// ----------------------------------------------------------------------------
// wxTextDataObject
// ----------------------------------------------------------------------------
#if defined(__WXGTK20__) && wxUSE_UNICODE
void wxTextDataObject::GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir) const
{
*formats++ = GetPreferredFormat();
*formats = g_altTextAtom;
}
#endif
// ----------------------------------------------------------------------------
// wxFileDataObject
// ----------------------------------------------------------------------------