We called g_signal_connect("selection_get") in wxClipboard code each time its
AddData() method was called. This resulted in progressive but noticeable
slowdown as the handler was called more and more times.
Only connect to the handler once now.
Closes #15038.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73518
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
GtkWidget *m_clipboardWidget; // for getting and offering data
GtkWidget *m_targetsWidget; // for getting list of supported formats
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;
bool m_open;
bool m_formatSupported;
wxClipboard::wxClipboard()
{
wxClipboard::wxClipboard()
{
+ m_idSelectionGetHandler = 0;
+
m_open = false;
m_dataPrimary =
m_open = false;
m_dataPrimary =
AddSupportedTarget(format);
}
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()) );
G_CALLBACK (selection_handler),
GUINT_TO_POINTER (gtk_get_current_event_time()) );
// tell the world we offer clipboard data
return SetSelectionOwner();
// tell the world we offer clipboard data
return SetSelectionOwner();