[gimp] Bug 757905 - using select tool on image in one tab causes user to lose...



commit 909ecd4e795254122944ef58716de73c901fc9d3
Author: Michael Natterer <mitch gimp org>
Date:   Fri Nov 20 20:51:23 2015 +0100

    Bug 757905 - using select tool on image in one tab causes user to lose...
    
    ...selection on image in another tab
    
    Fixed for rectangle select, ellipse select and crop, they now all
    confirm the previous display's tool interaction instead of aborting it
    when the tool is used on another display.

 app/tools/gimpcroptool.c            |    2 +-
 app/tools/gimprectangleselecttool.c |    7 ++-----
 app/tools/gimprectangletool.c       |   25 +++++++++----------------
 3 files changed, 12 insertions(+), 22 deletions(-)
---
diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c
index b2c6814..4543083 100644
--- a/app/tools/gimpcroptool.c
+++ b/app/tools/gimpcroptool.c
@@ -234,7 +234,7 @@ gimp_crop_tool_button_press (GimpTool            *tool,
                              GimpDisplay         *display)
 {
   if (tool->display && display != tool->display)
-    gimp_rectangle_tool_cancel (GIMP_RECTANGLE_TOOL (tool));
+    gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, tool->display);
 
   gimp_tool_control_activate (tool->control);
 
diff --git a/app/tools/gimprectangleselecttool.c b/app/tools/gimprectangleselecttool.c
index e352c96..b6ef0ef 100644
--- a/app/tools/gimprectangleselecttool.c
+++ b/app/tools/gimprectangleselecttool.c
@@ -361,9 +361,7 @@ gimp_rectangle_select_tool_button_press (GimpTool            *tool,
   priv          = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
 
   if (tool->display && display != tool->display)
-    {
-      gimp_rectangle_tool_cancel (GIMP_RECTANGLE_TOOL (tool));
-    }
+    gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, tool->display);
 
   if (gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (tool),
                                       display, coords))
@@ -371,8 +369,7 @@ gimp_rectangle_select_tool_button_press (GimpTool            *tool,
       /* In some cases we want to finish the rectangle select tool
        * and hand over responsibility to the selection tool
        */
-      gimp_rectangle_tool_execute (rectangle);
-      gimp_rectangle_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
+      gimp_rectangle_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, display);
       gimp_rectangle_select_tool_update_option_defaults (rect_sel_tool,
                                                          TRUE);
       return;
diff --git a/app/tools/gimprectangletool.c b/app/tools/gimprectangletool.c
index 0465314..79ec0ba 100644
--- a/app/tools/gimprectangletool.c
+++ b/app/tools/gimprectangletool.c
@@ -876,7 +876,9 @@ gimp_rectangle_tool_control (GimpTool       *tool,
       gimp_rectangle_tool_halt (rect_tool);
       break;
 
-    default:
+    case GIMP_TOOL_ACTION_COMMIT:
+      if (gimp_rectangle_tool_execute (rect_tool))
+        gimp_rectangle_tool_halt (rect_tool);
       break;
     }
 }
@@ -907,13 +909,8 @@ gimp_rectangle_tool_button_press (GimpTool         *tool,
 
   if (display != tool->display)
     {
-      if (gimp_draw_tool_is_active (draw_tool))
-        {
-          GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
-
-          gimp_display_shell_set_highlight (shell, NULL);
-          gimp_draw_tool_stop (draw_tool);
-        }
+      if (tool->display)
+        gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, display);
 
       gimp_rectangle_tool_set_function (rect_tool,
                                         GIMP_RECTANGLE_TOOL_CREATING);
@@ -1035,9 +1032,7 @@ gimp_rectangle_tool_button_release (GimpTool              *tool,
 
       /* If the first created rectangle was canceled, halt the tool */
       if (gimp_rectangle_tool_rectangle_is_new (rect_tool))
-        {
-          gimp_rectangle_tool_halt (rect_tool);
-        }
+        gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
 
       break;
 
@@ -1047,8 +1042,7 @@ gimp_rectangle_tool_button_release (GimpTool              *tool,
       if (private->function == GIMP_RECTANGLE_TOOL_DEAD)
         break;
 
-      if (gimp_rectangle_tool_execute (rect_tool))
-        gimp_rectangle_tool_halt (rect_tool);
+      gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, display);
       break;
 
     case GIMP_BUTTON_RELEASE_NO_MOTION:
@@ -1448,13 +1442,12 @@ gimp_rectangle_tool_key_press (GimpTool    *tool,
     case GDK_KEY_Return:
     case GDK_KEY_KP_Enter:
     case GDK_KEY_ISO_Enter:
-      if (gimp_rectangle_tool_execute (rect_tool))
-        gimp_rectangle_tool_halt (rect_tool);
+      gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, display);
       return TRUE;
 
     case GDK_KEY_Escape:
       gimp_rectangle_tool_cancel (rect_tool);
-      gimp_rectangle_tool_halt (rect_tool);
+      gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
       return TRUE;
 
     default:


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