app: make sure the blend tools doesn't stay around on removed drawables

Set gimp_tool_control_set_preserve() to TRUE and set an appropriate
dirty_mask, just like all tools which have a permanent on-canvas state
outside of a simple press-drag-release.
This commit is contained in:
Michael Natterer 2016-12-24 18:40:25 +01:00
parent e31f8e1195
commit 75be560e2a
1 changed files with 14 additions and 0 deletions

View File

@ -204,6 +204,12 @@ gimp_blend_tool_init (GimpBlendTool *blend_tool)
GimpTool *tool = GIMP_TOOL (blend_tool);
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
gimp_tool_control_set_preserve (tool->control, FALSE);
gimp_tool_control_set_dirty_mask (tool->control,
GIMP_DIRTY_IMAGE |
GIMP_DIRTY_IMAGE_STRUCTURE |
GIMP_DIRTY_DRAWABLE |
GIMP_DIRTY_ACTIVE_DRAWABLE);
gimp_tool_control_set_wants_click (tool->control, TRUE);
gimp_tool_control_set_precision (tool->control,
GIMP_CURSOR_PRECISION_SUBPIXEL);
@ -911,10 +917,14 @@ gimp_blend_tool_halt (GimpBlendTool *blend_tool)
if (blend_tool->filter)
{
gimp_tool_control_push_preserve (tool->control, TRUE);
gimp_drawable_filter_abort (blend_tool->filter);
g_object_unref (blend_tool->filter);
blend_tool->filter = NULL;
gimp_tool_control_pop_preserve (tool->control);
gimp_image_flush (gimp_display_get_image (tool->display));
}
@ -932,11 +942,15 @@ gimp_blend_tool_commit (GimpBlendTool *blend_tool)
if (blend_tool->filter)
{
gimp_tool_control_push_preserve (tool->control, TRUE);
gimp_drawable_filter_commit (blend_tool->filter,
GIMP_PROGRESS (tool), FALSE);
g_object_unref (blend_tool->filter);
blend_tool->filter = NULL;
gimp_tool_control_pop_preserve (tool->control);
gimp_image_flush (gimp_display_get_image (tool->display));
}
}