PixelPaint: Fix initial tool selection

This changes how the initial tool is beeing set on application startup.
With this change the initial tool is set the same way as when the tool
is changed via the frontend. Thus it also updates the tool properties
window which wasn't done before leaving the properties empty as long
the tool was changed for the first time.
This commit is contained in:
Torstennator 2023-12-11 19:55:48 +01:00 committed by Andrew Kaster
parent 2b44c4c3f7
commit d462d6280a
Notes: sideshowbarker 2024-07-17 02:23:25 +09:00

View file

@ -70,9 +70,12 @@ void ToolboxWidget::setup_tools()
tool->set_action(action);
m_tools.append(move(tool));
if (is_default_tool) {
VERIFY(m_active_tool == nullptr);
m_active_tool = m_tools[m_tools.size() - 1];
action->set_checked(true);
auto default_tool_index = m_tools.size() - 1;
deferred_invoke([&, default_tool_index]() {
VERIFY(m_active_tool == nullptr);
on_tool_selection(m_tools[default_tool_index]);
});
}
};