From bfd414ead9384ec8b95b7abbc7c8b57a1a2e3712 Mon Sep 17 00:00:00 2001 From: Jehan Date: Wed, 6 Aug 2025 19:34:05 +0200 Subject: [PATCH] Issue #9463: select back the previous tool when halting a layer effect. This implies both when canceling or committing a filter. Part of the fix is that we don't store filter tools as part of the tool history, which means that when we swap back to the previous tool, the filter tool info is dropped as though we never went through it. This way, filter tools don't actually look as other tools (even though they technically still are, since this is how we can implement canvas interaction for some of the filters). --- app/tools/gimpfiltertool.c | 3 +++ app/tools/tool_manager.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c index 7b1e932cd5..9b779f613f 100644 --- a/app/tools/gimpfiltertool.c +++ b/app/tools/gimpfiltertool.c @@ -1232,6 +1232,9 @@ gimp_filter_tool_halt (GimpFilterTool *filter_tool) } filter_tool->existing_filter = NULL; + + if (tool_manager_get_active (tool->tool_info->gimp) == tool) + tool_manager_swap_tools (tool->tool_info->gimp); } static void diff --git a/app/tools/tool_manager.c b/app/tools/tool_manager.c index 50ab28d013..04327de3d2 100644 --- a/app/tools/tool_manager.c +++ b/app/tools/tool_manager.c @@ -711,6 +711,16 @@ tool_manager_select_tool (GimpToolManager *tool_manager, tool_manager->history = g_list_delete_link (tool_manager->history, g_list_last (tool_manager->history)); } + + if (g_list_length (tool_manager->history) > 1) + { + /* Never store filter tool in history (only as current tool). */ + GList *prev_list = g_list_nth (tool_manager->history, 1); + GimpToolInfo *prev_tool = prev_list->data; + + if (g_type_is_a (prev_tool->tool_type, GIMP_TYPE_FILTER_TOOL)) + tool_manager->history = g_list_delete_link (tool_manager->history, prev_list); + } } g_set_object (&tool_manager->active_tool, tool);