[gimp] app: make sure the blend tools doesn't stay around on removed drawables



commit 75be560e2afd142d057ee7f3144950cf5054cfae
Author: Michael Natterer <mitch gimp org>
Date:   Sat Dec 24 18:40:25 2016 +0100

    app: make sure the blend tools doesn't stay around on removed drawables
    
    Set gimp_tool_control_set_preserve() to TRUE and set an appropriate
    dirty_mask, just like all tools which have a permanent on-canvas state
    outside of a simple press-drag-release.

 app/tools/gimpblendtool.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c
index 49ef9f9..f219fb9 100644
--- a/app/tools/gimpblendtool.c
+++ b/app/tools/gimpblendtool.c
@@ -204,6 +204,12 @@ gimp_blend_tool_init (GimpBlendTool *blend_tool)
   GimpTool *tool = GIMP_TOOL (blend_tool);
 
   gimp_tool_control_set_scroll_lock     (tool->control, TRUE);
+  gimp_tool_control_set_preserve        (tool->control, FALSE);
+  gimp_tool_control_set_dirty_mask      (tool->control,
+                                         GIMP_DIRTY_IMAGE           |
+                                         GIMP_DIRTY_IMAGE_STRUCTURE |
+                                         GIMP_DIRTY_DRAWABLE        |
+                                         GIMP_DIRTY_ACTIVE_DRAWABLE);
   gimp_tool_control_set_wants_click     (tool->control, TRUE);
   gimp_tool_control_set_precision       (tool->control,
                                          GIMP_CURSOR_PRECISION_SUBPIXEL);
@@ -911,10 +917,14 @@ gimp_blend_tool_halt (GimpBlendTool *blend_tool)
 
   if (blend_tool->filter)
     {
+      gimp_tool_control_push_preserve (tool->control, TRUE);
+
       gimp_drawable_filter_abort (blend_tool->filter);
       g_object_unref (blend_tool->filter);
       blend_tool->filter = NULL;
 
+      gimp_tool_control_pop_preserve (tool->control);
+
       gimp_image_flush (gimp_display_get_image (tool->display));
     }
 
@@ -932,11 +942,15 @@ gimp_blend_tool_commit (GimpBlendTool *blend_tool)
 
   if (blend_tool->filter)
     {
+      gimp_tool_control_push_preserve (tool->control, TRUE);
+
       gimp_drawable_filter_commit (blend_tool->filter,
                                    GIMP_PROGRESS (tool), FALSE);
       g_object_unref (blend_tool->filter);
       blend_tool->filter = NULL;
 
+      gimp_tool_control_pop_preserve (tool->control);
+
       gimp_image_flush (gimp_display_get_image (tool->display));
     }
 }


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