git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54742
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
- void *d = malloc(size);
- wxON_BLOCK_EXIT1(free, d);
+ wxCharBuffer buf(size);
- // Text data will be in UTF8 in Unicode mode.
- data->GetDataHere( selection_data->target, d );
+ // text data must be returned in UTF8 if format is wxDF_UNICODETEXT
+ data->GetDataHere( format, buf.data() );
- // NB: GTK+ requires special treatment of UTF8_STRING data, the text
- // would show as UTF-8 data interpreted as latin1 (?) in other
- // GTK+ apps if we used gtk_selection_data_set()
+ // use UTF8_STRING format if requested in Unicode build but just plain
+ // STRING one in ANSI or if explicitly asked in Unicode
+#if wxUSE_UNICODE
if (format == wxDataFormat(wxDF_UNICODETEXT))
{
gtk_selection_data_set_text(
selection_data,
if (format == wxDataFormat(wxDF_UNICODETEXT))
{
gtk_selection_data_set_text(
selection_data,
+ (const gchar*)buf.data(),
{
gtk_selection_data_set(
selection_data,
GDK_SELECTION_TYPE_STRING,
8*sizeof(gchar),
{
gtk_selection_data_set(
selection_data,
GDK_SELECTION_TYPE_STRING,
8*sizeof(gchar),
+ (const guchar*)buf.data(),