[gimp/gimp-2-10] app: fix dirty mask/action in the rectangle- and free-select tools



commit 03cb47f871368887a2fea6b33fd58104f4ee1793
Author: Ell <ell_se yahoo com>
Date:   Thu Apr 25 07:07:13 2019 -0400

    app: fix dirty mask/action in the rectangle- and free-select tools
    
    In GimpRectangleSelectTool and GimpFreeSelectTool, make sure the
    tool is committed when the selection is dirty.
    
    (cherry picked from commit 6a2bea733b90d04aee914b74c0453ee7d5c40b59)

 app/tools/gimpfreeselecttool.c      | 15 +++++++++++++--
 app/tools/gimprectangleselecttool.c |  2 ++
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c
index aa3005b222..c9859d603e 100644
--- a/app/tools/gimpfreeselecttool.c
+++ b/app/tools/gimpfreeselecttool.c
@@ -129,8 +129,13 @@ gimp_free_select_tool_init (GimpFreeSelectTool *free_sel)
 
   free_sel->priv = gimp_free_select_tool_get_instance_private (free_sel);
 
-  gimp_tool_control_set_tool_cursor (tool->control,
-                                     GIMP_TOOL_CURSOR_FREE_SELECT);
+  gimp_tool_control_set_preserve     (tool->control, FALSE);
+  gimp_tool_control_set_dirty_mask   (tool->control,
+                                      GIMP_DIRTY_SELECTION);
+  gimp_tool_control_set_dirty_action (tool->control,
+                                      GIMP_TOOL_ACTION_COMMIT);
+  gimp_tool_control_set_tool_cursor  (tool->control,
+                                      GIMP_TOOL_CURSOR_FREE_SELECT);
 }
 
 static void
@@ -278,6 +283,7 @@ gimp_free_select_tool_select (GimpFreeSelectTool *free_sel,
                               GimpDisplay        *display)
 {
   GimpSelectionOptions      *options = GIMP_SELECTION_TOOL_GET_OPTIONS (free_sel);
+  GimpTool                  *tool    = GIMP_TOOL (free_sel);
   GimpFreeSelectToolPrivate *priv    = free_sel->priv;
   GimpImage                 *image   = gimp_display_get_image (display);
   const GimpVector2         *points;
@@ -288,6 +294,9 @@ gimp_free_select_tool_select (GimpFreeSelectTool *free_sel,
 
   if (n_points > 2)
     {
+      /* prevent this change from halting the tool */
+      gimp_tool_control_push_preserve (tool->control, TRUE);
+
       gimp_channel_select_polygon (gimp_image_get_mask (image),
                                    C_("command", "Free Select"),
                                    n_points,
@@ -298,5 +307,7 @@ gimp_free_select_tool_select (GimpFreeSelectTool *free_sel,
                                    options->feather_radius,
                                    options->feather_radius,
                                    TRUE);
+
+      gimp_tool_control_pop_preserve (tool->control);
     }
 }
diff --git a/app/tools/gimprectangleselecttool.c b/app/tools/gimprectangleselecttool.c
index e1c27a692d..096d4bb651 100644
--- a/app/tools/gimprectangleselecttool.c
+++ b/app/tools/gimprectangleselecttool.c
@@ -190,6 +190,8 @@ gimp_rectangle_select_tool_init (GimpRectangleSelectTool *rect_tool)
   gimp_tool_control_set_dirty_mask       (tool->control,
                                           GIMP_DIRTY_IMAGE_SIZE |
                                           GIMP_DIRTY_SELECTION);
+  gimp_tool_control_set_dirty_action     (tool->control,
+                                          GIMP_TOOL_ACTION_COMMIT);
 }
 
 static void


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