[gimp] app: make sure mouse-selecting doesn't push an undo step



commit 1fb61b8515f2b81e9168233e8e7118d1dcf9203e
Author: Michael Natterer <mitch gimp org>
Date:   Tue Mar 2 13:04:37 2010 +0100

    app: make sure mouse-selecting doesn't push an undo step
    
    GtkTextBuffer emits "end-user-action" after something has been copied
    to the clipboard. Work around that bug.

 app/tools/gimptexttool.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index ce11b51..496a694 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -486,8 +486,22 @@ gimp_text_tool_button_release (GimpTool              *tool,
        *  an existing text layer), so finish the selection process and
        *  ignore rectangle-change-complete.
        */
+
+      /*  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_edited,
+                                       text_tool);
+
       gimp_text_tool_editor_button_release (text_tool);
 
+      g_signal_handlers_unblock_by_func (text_tool->buffer,
+                                         gimp_text_tool_buffer_edited,
+                                         text_tool);
+
       text_tool->selecting = FALSE;
 
       text_tool->handle_rectangle_change_complete = FALSE;



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