[gimp/gimp-2-10] app: flush image when committing free-select tool



commit dd2632bc85af9c083afc4319f39f08aa145d5bd4
Author: Ell <ell_se yahoo com>
Date:   Fri Apr 26 03:35:20 2019 -0400

    app: flush image when committing free-select tool
    
    In GimpFreeSelectTool, flush the image when committing the tool, if
    the seletion is created at the time of the commit (i.e., if the
    polygon is not closed prior to the commit).
    
    (cherry picked from commit 71c624c5aba2b007f4b6ebd0cfe7dcfd46ab3508)

 app/tools/gimpfreeselecttool.c | 67 +++++++++++++++++++++++-------------------
 1 file changed, 37 insertions(+), 30 deletions(-)
---
diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c
index c9859d603e..46b036c097 100644
--- a/app/tools/gimpfreeselecttool.c
+++ b/app/tools/gimpfreeselecttool.c
@@ -54,34 +54,34 @@ struct _GimpFreeSelectToolPrivate
 };
 
 
-static void   gimp_free_select_tool_control         (GimpTool              *tool,
-                                                     GimpToolAction         action,
-                                                     GimpDisplay           *display);
-static void   gimp_free_select_tool_button_press    (GimpTool              *tool,
-                                                     const GimpCoords      *coords,
-                                                     guint32                time,
-                                                     GdkModifierType        state,
-                                                     GimpButtonPressType    press_type,
-                                                     GimpDisplay           *display);
-static void   gimp_free_select_tool_button_release  (GimpTool              *tool,
-                                                     const GimpCoords      *coords,
-                                                     guint32                time,
-                                                     GdkModifierType        state,
-                                                     GimpButtonReleaseType  release_type,
-                                                     GimpDisplay           *display);
-static void   gimp_free_select_tool_options_notify  (GimpTool              *tool,
-                                                     GimpToolOptions       *options,
-                                                     const GParamSpec      *pspec);
-
-static void   gimp_free_select_tool_change_complete (GimpPolygonSelectTool *poly_sel,
-                                                     GimpDisplay           *display);
-
-static void   gimp_free_select_tool_commit          (GimpFreeSelectTool    *free_sel,
-                                                     GimpDisplay           *display);
-static void   gimp_free_select_tool_halt            (GimpFreeSelectTool    *free_sel);
-
-static void   gimp_free_select_tool_select          (GimpFreeSelectTool    *free_sel,
-                                                     GimpDisplay           *display);
+static void       gimp_free_select_tool_control         (GimpTool              *tool,
+                                                         GimpToolAction         action,
+                                                         GimpDisplay           *display);
+static void       gimp_free_select_tool_button_press    (GimpTool              *tool,
+                                                         const GimpCoords      *coords,
+                                                         guint32                time,
+                                                         GdkModifierType        state,
+                                                         GimpButtonPressType    press_type,
+                                                         GimpDisplay           *display);
+static void       gimp_free_select_tool_button_release  (GimpTool              *tool,
+                                                         const GimpCoords      *coords,
+                                                         guint32                time,
+                                                         GdkModifierType        state,
+                                                         GimpButtonReleaseType  release_type,
+                                                         GimpDisplay           *display);
+static void       gimp_free_select_tool_options_notify  (GimpTool              *tool,
+                                                         GimpToolOptions       *options,
+                                                         const GParamSpec      *pspec);
+
+static void       gimp_free_select_tool_change_complete (GimpPolygonSelectTool *poly_sel,
+                                                         GimpDisplay           *display);
+
+static void       gimp_free_select_tool_commit          (GimpFreeSelectTool    *free_sel,
+                                                         GimpDisplay           *display);
+static void       gimp_free_select_tool_halt            (GimpFreeSelectTool    *free_sel);
+
+static gboolean   gimp_free_select_tool_select          (GimpFreeSelectTool    *free_sel,
+                                                         GimpDisplay           *display);
 
 
 G_DEFINE_TYPE_WITH_PRIVATE (GimpFreeSelectTool, gimp_free_select_tool,
@@ -275,10 +275,13 @@ gimp_free_select_tool_commit (GimpFreeSelectTool *free_sel,
   GimpPolygonSelectTool *poly_sel = GIMP_POLYGON_SELECT_TOOL (free_sel);
 
   if (! gimp_polygon_select_tool_is_closed (poly_sel))
-    gimp_free_select_tool_select (free_sel, display);
+    {
+      if (gimp_free_select_tool_select (free_sel, display))
+        gimp_image_flush (gimp_display_get_image (display));
+    }
 }
 
-static void
+static gboolean
 gimp_free_select_tool_select (GimpFreeSelectTool *free_sel,
                               GimpDisplay        *display)
 {
@@ -309,5 +312,9 @@ gimp_free_select_tool_select (GimpFreeSelectTool *free_sel,
                                    TRUE);
 
       gimp_tool_control_pop_preserve (tool->control);
+
+      return TRUE;
     }
+
+  return FALSE;
 }


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