浏览代码

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 年之前
父节点
当前提交
d462d6280a
共有 1 个文件被更改,包括 5 次插入2 次删除
  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);
         tool->set_action(action);
         m_tools.append(move(tool));
         m_tools.append(move(tool));
         if (is_default_tool) {
         if (is_default_tool) {
-            VERIFY(m_active_tool == nullptr);
-            m_active_tool = m_tools[m_tools.size() - 1];
             action->set_checked(true);
             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]);
+            });
         }
         }
     };
     };