X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/385e8575dd1f9219fb0e3f7fa26ffe4c24d2fdbb..ad653fa23069c5d9378247084f03c9a718c3ad62:/src/gtk/clipbrd.cpp?ds=sidebyside diff --git a/src/gtk/clipbrd.cpp b/src/gtk/clipbrd.cpp index 6e02151f4b..e41b5e654c 100644 --- a/src/gtk/clipbrd.cpp +++ b/src/gtk/clipbrd.cpp @@ -328,7 +328,7 @@ selection_handler( GtkWidget *WXUNUSED(widget), { gtk_selection_data_set( selection_data, - GDK_SELECTION_TYPE_STRING, + format.GetFormatId(), 8*sizeof(gchar), (const guchar*)buf.data(), size ); @@ -344,7 +344,7 @@ void wxClipboard::GTKOnSelectionReceived(const GtkSelectionData& sel) wxLogTrace(TRACE_CLIPBOARD, wxT("Received selection %s"), format.GetId().c_str()); - if ( !m_receivedData->IsSupportedFormat(format) ) + if ( !m_receivedData->IsSupportedFormat(format, wxDataObject::Set) ) return; m_receivedData->SetData(format, @@ -434,6 +434,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject) wxClipboard::wxClipboard() { + m_idSelectionGetHandler = 0; + m_open = false; m_dataPrimary = @@ -507,7 +509,7 @@ bool wxClipboard::SetSelectionOwner(bool set) set ? m_clipboardWidget : NULL, GTKGetClipboardAtom(), (guint32)GDK_CURRENT_TIME - ); + ) != 0; if ( !rc ) { @@ -642,9 +644,13 @@ bool wxClipboard::AddData( wxDataObject *data ) AddSupportedTarget(format); } - g_signal_connect (m_clipboardWidget, "selection_get", + if ( !m_idSelectionGetHandler ) + { + m_idSelectionGetHandler = g_signal_connect ( + m_clipboardWidget, "selection_get", G_CALLBACK (selection_handler), GUINT_TO_POINTER (gtk_get_current_event_time()) ); + } // tell the world we offer clipboard data return SetSelectionOwner();