[gimp] app: block text buffer signals around copying to the clipboard



commit e9f85b3afcb92e3e4dc25391b4c52d03c7771eaf
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 5 10:53:09 2010 +0100

    app: block text buffer signals around copying to the clipboard
    
    so the copying doesn't produce an undo step. Same fix as applied
    earlier in button_press().

 app/tools/gimptexttool.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 3c4a4ca..5fddfe8 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -1804,8 +1804,27 @@ gimp_text_tool_copy_clipboard (GimpTextTool *text_tool)
   clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell),
                                         GDK_SELECTION_CLIPBOARD);
 
+  /*  need to block "end-user-action" on the text buffer, because
+   *  GtkTextBuffer considers copying text to the clipboard an
+   *  undo-relevant user action, which is clearly a bug, but what
+   *  can we do...
+   */
+  g_signal_handlers_block_by_func (text_tool->buffer,
+                                   gimp_text_tool_buffer_begin_edit,
+                                   text_tool);
+  g_signal_handlers_block_by_func (text_tool->buffer,
+                                   gimp_text_tool_buffer_end_edit,
+                                   text_tool);
+
   gtk_text_buffer_copy_clipboard (GTK_TEXT_BUFFER (text_tool->buffer),
                                   clipboard);
+
+  g_signal_handlers_unblock_by_func (text_tool->buffer,
+                                     gimp_text_tool_buffer_end_edit,
+                                     text_tool);
+  g_signal_handlers_unblock_by_func (text_tool->buffer,
+                                     gimp_text_tool_buffer_begin_edit,
+                                     text_tool);
 }
 
 void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]