[gimp] app: don't base GimpToolRectangle's new "is_first" on rectangle extents



commit 56d87724a3d53a6e69b1c19f61630cc9ecb9c7f9
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jun 29 20:48:41 2017 +0200

    app: don't base GimpToolRectangle's new "is_first" on rectangle extents
    
    they also get set externally so are broken to use. Instead, simply set
    "is_first" to TRUE in init() and to FALSE in button_release().

 app/display/gimptoolrectangle.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)
---
diff --git a/app/display/gimptoolrectangle.c b/app/display/gimptoolrectangle.c
index 89dd018..9a9e44a 100644
--- a/app/display/gimptoolrectangle.c
+++ b/app/display/gimptoolrectangle.c
@@ -686,6 +686,7 @@ gimp_tool_rectangle_init (GimpToolRectangle *rectangle)
                                                     GimpToolRectanglePrivate);
 
   rectangle->private->function = GIMP_TOOL_RECTANGLE_CREATING;
+  rectangle->private->is_first = TRUE;
 }
 
 static void
@@ -1401,16 +1402,6 @@ gimp_tool_rectangle_button_press (GimpToolWidget      *widget,
   private->lastx = snapped_x;
   private->lasty = snapped_y;
 
-  if (private->x1 == private->x2 &&
-      private->y1 == private->y2)
-    {
-      private->is_first = TRUE;
-    }
-  else
-    {
-      private->is_first = FALSE;
-    }
-
   if (private->function == GIMP_TOOL_RECTANGLE_CREATING)
     {
       /* Remember that this rectangle was created from scratch. */
@@ -1546,6 +1537,8 @@ gimp_tool_rectangle_button_release (GimpToolWidget        *widget,
 
   gimp_tool_rectangle_changed (widget);
 
+  private->is_first = FALSE;
+
   /*  emit response at the end, so everything is up to date even if
    *  a signal handler decides hot to shut down the rectangle
    */


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