X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/05492dd1eb5c8d5407de9fa09372c61de00f1d9d..05e0b047d879cdbfade7f2ab346c0acdf3e29f96:/src/gtk/clipbrd.cpp diff --git a/src/gtk/clipbrd.cpp b/src/gtk/clipbrd.cpp index 143a624fdc..40b68026a0 100644 --- a/src/gtk/clipbrd.cpp +++ b/src/gtk/clipbrd.cpp @@ -80,7 +80,7 @@ public: // this method must be called by GTK+ callbacks to indicate that we got the // result for our clipboard operation - static void OnDone(wxClipboard *clipboard) + static void OnDone(wxClipboard * WXUNUSED_UNLESS_DEBUG(clipboard)) { wxASSERT_MSG( clipboard == ms_clipboard, _T("got notification for alien clipboard") ); @@ -299,29 +299,29 @@ selection_handler( GtkWidget *WXUNUSED(widget), if (size == 0) return; - 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, - (const gchar*)d, + (const gchar*)buf.data(), size ); } else +#endif { gtk_selection_data_set( selection_data, GDK_SELECTION_TYPE_STRING, 8*sizeof(gchar), - (unsigned char*) d, + (const guchar*)buf.data(), size ); } } @@ -409,7 +409,7 @@ GdkAtom wxClipboard::GTKGetClipboardAtom() const void wxClipboard::GTKClearData(Kind kind) { - wxDataObject *&data = Data(); + wxDataObject *&data = Data(kind); if ( data ) { delete data; @@ -439,7 +439,7 @@ void wxClipboard::AddSupportedTarget(GdkAtom atom) { gtk_selection_add_target ( - GTK_WIDGET(m_clipboardWidget), + m_clipboardWidget, GTKGetClipboardAtom(), atom, 0 // info (same as client data) unused