Issue #15206: do not initialize transform tools when swapping tools…

… automatically.

We still initialize on manual swapping through the action.
This commit is contained in:
Jehan 2025-11-08 11:17:17 +01:00
parent 0dd7d9a936
commit b2e70c5b89
5 changed files with 20 additions and 11 deletions

View file

@ -74,7 +74,7 @@ tools_swap_cmd_callback (GimpAction *action,
return_if_no_gimp (gimp, data);
tool_manager_swap_tools (gimp);
tool_manager_swap_tools (gimp, FALSE);
}
void

View file

@ -484,7 +484,7 @@ swap_tools (gconstpointer data)
gimp_context_set_tool (user_context, second_tool_info);
g_assert (gimp_context_get_tool (user_context) == second_tool_info);
tool_manager_swap_tools (gimp);
tool_manager_swap_tools (gimp, FALSE);
g_assert (gimp_context_get_tool (user_context) == first_tool_info);
}
}

View file

@ -1234,7 +1234,7 @@ 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);
tool_manager_swap_tools (tool->tool_info->gimp, TRUE);
}
static void

View file

@ -56,6 +56,7 @@ struct _GimpToolManager
GSList *tool_stack;
GList *history;
gboolean block_initialization;
GimpToolGroup *active_tool_group;
@ -121,8 +122,9 @@ tool_manager_init (Gimp *gimp)
tool_manager = g_slice_new0 (GimpToolManager);
tool_manager->gimp = gimp;
tool_manager->history = NULL;
tool_manager->gimp = gimp;
tool_manager->history = NULL;
tool_manager->block_initialization = FALSE;
g_object_set_qdata (G_OBJECT (gimp), tool_manager_quark, tool_manager);
@ -282,7 +284,8 @@ tool_manager_pop_tool (Gimp *gimp)
}
void
tool_manager_swap_tools (Gimp *gimp)
tool_manager_swap_tools (Gimp *gimp,
gboolean block_initialization)
{
GimpToolManager *tool_manager;
@ -291,8 +294,12 @@ tool_manager_swap_tools (Gimp *gimp)
tool_manager = tool_manager_get (gimp);
if (g_list_length (tool_manager->history) > 1)
gimp_context_set_tool (tool_manager->gimp->user_context,
g_list_nth_data (tool_manager->history, 1));
{
tool_manager->block_initialization = block_initialization;
gimp_context_set_tool (tool_manager->gimp->user_context,
g_list_nth_data (tool_manager->history, 1));
tool_manager->block_initialization = FALSE;
}
}
gboolean
@ -816,8 +823,9 @@ tool_manager_tool_changed (GimpContext *user_context,
tool_manager_select_tool (tool_manager, new_tool);
/* Auto-activate any transform or GEGL operation tools */
if (GIMP_IS_TRANSFORM_GRID_TOOL (new_tool) ||
GIMP_IS_GEGL_TOOL (new_tool))
if (! tool_manager->block_initialization &&
(GIMP_IS_TRANSFORM_GRID_TOOL (new_tool) ||
GIMP_IS_GEGL_TOOL (new_tool)))
{
GimpDisplay *new_display;

View file

@ -27,7 +27,8 @@ void tool_manager_push_tool (Gimp *gimp,
GimpTool *tool);
void tool_manager_pop_tool (Gimp *gimp);
void tool_manager_swap_tools (Gimp *gimp);
void tool_manager_swap_tools (Gimp *gimp,
gboolean block_initialization);
gboolean tool_manager_initialize_active (Gimp *gimp,
GimpDisplay *display);