Browse Source

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.
Torstennator 1 year ago
parent
commit
d462d6280a
1 changed files with 5 additions and 2 deletions
  1. 5 2
      Userland/Applications/PixelPaint/ToolboxWidget.cpp

+ 5 - 2
Userland/Applications/PixelPaint/ToolboxWidget.cpp

@@ -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]);
+            });
         }
     };