[gimp] app: fix modifying the selection while GimpRectangleSelectTool is active
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: fix modifying the selection while GimpRectangleSelectTool is active
- Date: Sun, 9 Jul 2017 18:53:12 +0000 (UTC)
commit 77f1424777351744faff31799fc900e25cb7fd4d
Author: Michael Natterer <mitch gimp org>
Date: Sun Jul 9 20:47:21 2017 +0200
app: fix modifying the selection while GimpRectangleSelectTool is active
if did revert to the previous selection and thus break stuff like
enbaling quick mask or inverting the selection, because I merged the
undo magic it does into gimp_rectangle_select_tool_halt(), whereas
before it was done by the former gimp_rectangle_tool_cancel(), so only
on explicit cancel not HALT from whatever source.
Do the same in the new code and move the undo magic from halt() to
rectangle_response(CANCEL), which is exactly the same distinction as
with the old GimpRectangleTool code.
app/tools/gimprectangleselecttool.c | 49 ++++++++++++++++++++---------------
1 files changed, 28 insertions(+), 21 deletions(-)
---
diff --git a/app/tools/gimprectangleselecttool.c b/app/tools/gimprectangleselecttool.c
index 93c52fe..9077168 100644
--- a/app/tools/gimprectangleselecttool.c
+++ b/app/tools/gimprectangleselecttool.c
@@ -563,7 +563,8 @@ gimp_rectangle_select_tool_rectangle_response (GimpToolWidget *widget,
gint response_id,
GimpRectangleSelectTool *rect_tool)
{
- GimpTool *tool = GIMP_TOOL (rect_tool);
+ GimpTool *tool = GIMP_TOOL (rect_tool);
+ GimpRectangleSelectToolPrivate *priv = rect_tool->private;
switch (response_id)
{
@@ -590,7 +591,31 @@ gimp_rectangle_select_tool_rectangle_response (GimpToolWidget *widget,
break;
case GIMP_TOOL_WIDGET_RESPONSE_CANCEL:
- gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, tool->display);
+ {
+ GimpImage *image = gimp_display_get_image (tool->display);
+ GimpUndoStack *undo_stack = gimp_image_get_undo_stack (image);
+ GimpUndo *undo = gimp_undo_stack_peek (undo_stack);
+
+ /* if we have an existing rectangle in the current display, then
+ * we have already "executed", and need to undo at this point,
+ * unless the user has done something in the meantime
+ */
+ if (undo && priv->undo == undo)
+ {
+ /* prevent this change from halting the tool */
+ gimp_tool_control_push_preserve (tool->control, TRUE);
+
+ gimp_image_undo (image);
+ gimp_image_flush (image);
+
+ gimp_tool_control_pop_preserve (tool->control);
+ }
+
+ priv->undo = NULL;
+ priv->redo = NULL;
+
+ gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, tool->display);
+ }
break;
}
}
@@ -849,31 +874,13 @@ gimp_rectangle_select_tool_halt (GimpRectangleSelectTool *rect_tool)
if (tool->display)
{
- GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
- GimpImage *image = gimp_display_get_image (tool->display);
- GimpUndoStack *undo_stack = gimp_image_get_undo_stack (image);
- GimpUndo *undo = gimp_undo_stack_peek (undo_stack);
+ GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
gimp_display_shell_set_highlight (shell, NULL);
gimp_rectangle_options_disconnect (GIMP_RECTANGLE_OPTIONS (options),
G_CALLBACK (gimp_rectangle_select_tool_auto_shrink),
rect_tool);
-
- /* if we have an existing rectangle in the current display, then
- * we have already "executed", and need to undo at this point,
- * unless the user has done something in the meantime
- */
- if (undo && priv->undo == undo)
- {
- /* prevent this change from halting the tool */
- gimp_tool_control_push_preserve (tool->control, TRUE);
-
- gimp_image_undo (image);
- gimp_image_flush (image);
-
- gimp_tool_control_pop_preserve (tool->control);
- }
}
priv->undo = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]