[RFC Patch] gnome-terminal use gtk_clipboard_wait_is_text_available when 'Edit' menu selected

Xavier Toth txtoth at gmail.com
Mon Mar 17 17:04:25 UTC 2008


This patch replaces the use of gtk_clipboard_request_text with
gtk_clipboard_wait_is_text_available when
the 'Edit' menu is selected. gtk_clipboard_wait_is_text_available will
be a little faster as it doesn't retreive
the text and selection  or clipbord managers will only receive one
selection-request-event for the data when
the 'Paste' occurs if it ever does. Without this change
selection-request-event listeners like selection or
clipboard managers receive two selection-request-event one when the
'Edit' menu is selected and the other
when 'Paste' is selected and there is no way to differentiate them.


--- gnome-terminal-2.18.4/src/terminal-window.c	2008-03-17
11:30:21.000000000 -0500
+++ gnome-terminal-2.18.4.new/src/terminal-window.c	2008-03-17
11:29:47.000000000 -0500
@@ -753,7 +753,11 @@

   window = (TerminalWindow *) user_data;

-  gtk_clipboard_request_text (window->priv->clipboard,
(GtkClipboardTextReceivedFunc) update_edit_menu, window);
+  if (gtk_clipboard_wait_is_text_available (window->priv->clipboard))
+          update_edit_menu (window->priv->clipboard, "", window);
+  else
+          update_edit_menu (window->priv->clipboard, NULL, window);
+
 }

 static void




More information about the devel mailing list