[gimp] app: fix initializing a rectangle select by clicking into a selection



commit 5bf0e3c3d2eb257eb6c566da0429fe23721bf854
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jul 9 20:09:23 2017 +0200

    app: fix initializing a rectangle select by clicking into a selection
    
    Don't unconditionally call COMMIT in rectangle_response(), because
    that now implicitly HALTs the tool. Instead, check if we got here
    because of a click, and call our commit() directly.

 app/tools/gimprectangleselecttool.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/app/tools/gimprectangleselecttool.c b/app/tools/gimprectangleselecttool.c
index ee3540a..93c52fe 100644
--- a/app/tools/gimprectangleselecttool.c
+++ b/app/tools/gimprectangleselecttool.c
@@ -568,7 +568,25 @@ gimp_rectangle_select_tool_rectangle_response (GimpToolWidget          *widget,
   switch (response_id)
     {
     case GIMP_TOOL_WIDGET_RESPONSE_CONFIRM:
-      gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, tool->display);
+      {
+        gdouble x1, y1, x2, y2;
+
+        gimp_tool_rectangle_get_public_rect (GIMP_TOOL_RECTANGLE (widget),
+                                             &x1, &y1, &x2, &y2);
+        if (x1 == x2 && y1 == y2)
+          {
+            /*  if there are no extents, we got here because of a
+             *  click, call commit() directly because we might want to
+             *  reconfigure the rectangle and continue, instead of
+             *  HALTing it like calling COMMIT would do
+             */
+            gimp_rectangle_select_tool_commit (rect_tool);
+          }
+        else
+          {
+            gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, tool->display);
+          }
+      }
       break;
 
     case GIMP_TOOL_WIDGET_RESPONSE_CANCEL:


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