[gimp] Bug 559716 - Changing crop size in Crop Tool Options can make UI unresponsive



commit ec1108d62a671279779514c66dab15b0ca65c24b
Author: Michael Natterer <mitch gimp org>
Date:   Mon Mar 21 14:38:26 2011 +0100

    Bug 559716 - Changing crop size in Crop Tool Options can make UI unresponsive
    
    In gimp_rectangle_tool_update_options(), freeze()/thaw() notifications
    around setting setting x, y, width, height, so all values are
    up-to-date when "notify" is emitted. Also, only set the values that
    have actually changed so we don't process notifications when no change
    was done.

 app/tools/gimprectangletool.c |   43 ++++++++++++++++++++++++----------------
 1 files changed, 26 insertions(+), 17 deletions(-)
---
diff --git a/app/tools/gimprectangletool.c b/app/tools/gimprectangletool.c
index f3f4adf..b14879f 100644
--- a/app/tools/gimprectangletool.c
+++ b/app/tools/gimprectangletool.c
@@ -2323,35 +2323,44 @@ gimp_rectangle_tool_update_options (GimpRectangleTool *rect_tool,
 {
   GimpRectangleToolPrivate *private;
   GimpRectangleOptions     *options;
-  gdouble                   pub_x1, pub_y1;
-  gdouble                   pub_x2, pub_y2;
-  gdouble                   width;
-  gdouble                   height;
+  gdouble                   x1, y1;
+  gdouble                   x2, y2;
+  gdouble                   old_x;
+  gdouble                   old_y;
+  gdouble                   old_width;
+  gdouble                   old_height;
 
   private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (rect_tool);
   options = GIMP_RECTANGLE_TOOL_GET_OPTIONS (rect_tool);
 
-  gimp_rectangle_tool_get_public_rect (rect_tool,
-                                       &pub_x1, &pub_y1, &pub_x2, &pub_y2);
-  width  = pub_x2 - pub_x1;
-  height = pub_y2 - pub_y1;
+  gimp_rectangle_tool_get_public_rect (rect_tool, &x1, &y1, &x2, &y2);
 
   g_signal_handlers_block_by_func (options,
                                    gimp_rectangle_tool_options_notify,
                                    rect_tool);
 
-  g_object_set (options,
-                "x", pub_x1,
-                "y", pub_y1,
+  g_object_get (options,
+                "x",      &old_x,
+                "y",      &old_y,
+                "width",  &old_width,
+                "height", &old_height,
                 NULL);
 
-  g_object_set (options,
-                "width",  width,
-                NULL);
+  g_object_freeze_notify (G_OBJECT (options));
 
-  g_object_set (options,
-                "height", height,
-                NULL);
+  if (old_x != x1)
+    g_object_set (options, "x", x1, NULL);
+
+  if (old_y != y1)
+    g_object_set (options, "y", y1, NULL);
+
+  if (old_width != x2 - x1)
+    g_object_set (options, "width", x2 - x1, NULL);
+
+  if (old_height != y2 - y1)
+    g_object_set (options, "height", y2 - y1, NULL);
+
+  g_object_thaw_notify (G_OBJECT (options));
 
   g_signal_handlers_unblock_by_func (options,
                                      gimp_rectangle_tool_options_notify,



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