diff --git a/src/general.cpp b/src/general.cpp index ac78fdfc..6beb274b 100644 --- a/src/general.cpp +++ b/src/general.cpp @@ -516,6 +516,7 @@ void SwitcherData::LoadSettings(obs_data_t *obj) // Reset on startup and scene collection change switcher->lastOpenedTab = -1; + startupLoadDone = true; } void SwitcherData::SaveSettings(obs_data_t *obj) diff --git a/src/macro-core/macro.cpp b/src/macro-core/macro.cpp index 3892f6ba..76314ae7 100644 --- a/src/macro-core/macro.cpp +++ b/src/macro-core/macro.cpp @@ -30,7 +30,12 @@ Macro::~Macro() _die = true; Stop(); ClearHotkeys(); - RemoveDock(); + + // Keep the dock widgets in case of shutdown so they can be rostored by + // OBS on startup + if (!switcher->obsIsShuttingDown) { + RemoveDock(); + } } std::shared_ptr @@ -705,14 +710,16 @@ void Macro::EnableDock(bool value) // geometry set here. // The function calls here are only intended to attempt to restore the // dock status when switching scene collections. - _dock->setVisible(_dockIsVisible); - if (window->dockWidgetArea(_dock) != _dockArea) { - window->addDockWidget(_dockArea, _dock); + if (switcher->startupLoadDone) { + _dock->setVisible(_dockIsVisible); + if (window->dockWidgetArea(_dock) != _dockArea) { + window->addDockWidget(_dockArea, _dock); + } + if (_dock->isFloating() != _dockIsFloating) { + _dock->setFloating(_dockIsFloating); + } + _dock->restoreGeometry(_dockGeo); } - if (_dock->isFloating() != _dockIsFloating) { - _dock->setFloating(_dockIsFloating); - } - _dock->restoreGeometry(_dockGeo); _registerDock = value; } diff --git a/src/switcher-data.hpp b/src/switcher-data.hpp index 7b68d3ff..32987c81 100644 --- a/src/switcher-data.hpp +++ b/src/switcher-data.hpp @@ -124,6 +124,7 @@ public: bool firstInterval = true; bool firstIntervalAfterStop = true; int shutdownConditionCount = 0; + bool startupLoadDone = false; obs_source_t *waitScene = nullptr; OBSWeakSource currentScene = nullptr;