[gimp/gimp-2-10] app: commit the free selection before floating it.



commit 327b40792b3ed794b8ce65a90a312177e8724fac
Author: Jehan <jehan girinstud io>
Date:   Sun Jun 16 20:23:10 2019 +0200

    app: commit the free selection before floating it.
    
    When using a selection modifier Altr+Ctrl|Shift, we want to commit the
    selection. If I do it too late though, and if the polygon was not closed
    yet, the computed coordinates for the floating selection end up (0, 0)
    because it is based on the selection coordinates (yet an unclosed
    polygon does not create a selection yet). So commit the tool from within
    GimpSelectionTool instead, as soon as we confirmed that the class is
    going to take over with SELECTION_MOVE or SELECTION_MOVE_COPY.
    
    Note: ability of quick copying|cuting an unclosed polygon is very useful
    as it removes the additional step for a case where anyway committing the
    selection was a prerequisite.
    
    (cherry picked from commit 50f8cb8542a6adeeaef45996f57adf44b85ef534)

 app/tools/gimpfreeselecttool.c | 7 ++-----
 app/tools/gimpselectiontool.c  | 2 ++
 2 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c
index a146225276..b5624f5718 100644
--- a/app/tools/gimpfreeselecttool.c
+++ b/app/tools/gimpfreeselecttool.c
@@ -181,11 +181,8 @@ gimp_free_select_tool_button_press (GimpTool            *tool,
 
   if (gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (poly_sel),
                                       display, coords))
-    {
-      if (display)
-        gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, display);
-      return;
-    }
+    return;
+
   GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
                                                 press_type, display);
 
diff --git a/app/tools/gimpselectiontool.c b/app/tools/gimpselectiontool.c
index 45192e0799..8be7d28d21 100644
--- a/app/tools/gimpselectiontool.c
+++ b/app/tools/gimpselectiontool.c
@@ -614,6 +614,8 @@ gimp_selection_tool_start_edit (GimpSelectionTool *sel_tool,
       {
         GimpTranslateMode edit_mode;
 
+        gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, display);
+
         if (sel_tool->function == SELECTION_MOVE)
           edit_mode = GIMP_TRANSLATE_MODE_MASK_TO_LAYER;
         else


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