diff --git a/include/wx/gtk/clipbrd.h b/include/wx/gtk/clipbrd.h index 4af988f80c..ff24ad33dc 100644 --- a/include/wx/gtk/clipbrd.h +++ b/include/wx/gtk/clipbrd.h @@ -118,6 +118,9 @@ private: GtkWidget *m_clipboardWidget; // for getting and offering data GtkWidget *m_targetsWidget; // for getting list of supported formats + // ID of the connection to "selection_get" signal, initially 0. + unsigned long m_idSelectionGetHandler; + bool m_open; bool m_formatSupported; diff --git a/src/gtk/clipbrd.cpp b/src/gtk/clipbrd.cpp index 8b3d228a4f..e41b5e654c 100644 --- a/src/gtk/clipbrd.cpp +++ b/src/gtk/clipbrd.cpp @@ -434,6 +434,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject) wxClipboard::wxClipboard() { + m_idSelectionGetHandler = 0; + m_open = false; m_dataPrimary = @@ -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();