app: tool_manager: correctly preserve tool state across a push/pop
tool_manager_select_tool(): don't reset the previously active tool if it is only temporarily pushed to the tool stack. tool_manager_pop_tool(): don't try to restore the previously active tool's state because it was not reset on push().
This commit is contained in:
@ -168,7 +168,12 @@ tool_manager_select_tool (Gimp *gimp,
|
|||||||
|
|
||||||
tool_manager = tool_manager_get (gimp);
|
tool_manager = tool_manager_get (gimp);
|
||||||
|
|
||||||
if (tool_manager->active_tool)
|
/* reset the previously selected tool, but only if it is not only
|
||||||
|
* temporarily pushed to the tool stack
|
||||||
|
*/
|
||||||
|
if (tool_manager->active_tool &&
|
||||||
|
! (tool_manager->tool_stack &&
|
||||||
|
tool_manager->active_tool == tool_manager->tool_stack->data))
|
||||||
{
|
{
|
||||||
GimpTool *active_tool = tool_manager->active_tool;
|
GimpTool *active_tool = tool_manager->active_tool;
|
||||||
GimpDisplay *display;
|
GimpDisplay *display;
|
||||||
@ -224,20 +229,14 @@ tool_manager_pop_tool (Gimp *gimp)
|
|||||||
|
|
||||||
if (tool_manager->tool_stack)
|
if (tool_manager->tool_stack)
|
||||||
{
|
{
|
||||||
GimpTool *tool = tool_manager->tool_stack->data;
|
GimpTool *tool = tool_manager->tool_stack->data;
|
||||||
GimpDisplay *focus_display = NULL;
|
|
||||||
|
|
||||||
if (tool_manager->active_tool)
|
|
||||||
focus_display = tool_manager->active_tool->focus_display;
|
|
||||||
|
|
||||||
tool_manager->tool_stack = g_slist_remove (tool_manager->tool_stack,
|
tool_manager->tool_stack = g_slist_remove (tool_manager->tool_stack,
|
||||||
tool);
|
tool);
|
||||||
|
|
||||||
tool_manager_select_tool (gimp, tool);
|
tool_manager_select_tool (gimp, tool);
|
||||||
g_object_unref (tool);
|
|
||||||
|
|
||||||
if (focus_display)
|
g_object_unref (tool);
|
||||||
tool_manager_focus_display_active (gimp, focus_display);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user