# HG changeset patch # User Chris Cannam # Date 1579878729 0 # Node ID fda54e91ca05d8df7053af1c80cc335bb8235c9c # Parent 16932dfaf64e24a8af321977796d516ab424be69# Parent de79698944025eaf062e5f8587b461f982c3c1ce Merge from branch background-mode diff -r 16932dfaf64e -r fda54e91ca05 framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Wed Jan 15 14:00:18 2020 +0000 +++ b/framework/MainWindowBase.cpp Fri Jan 24 15:12:09 2020 +0000 @@ -211,14 +211,28 @@ SVDEBUG << "MainWindowBase: View font size is " << viewFontSize << endl; -#ifdef NOT_DEFINED // This no longer works correctly on any platform AFAICS +#ifndef Q_OS_MAC + Preferences::BackgroundMode mode = Preferences::getInstance()->getBackgroundMode(); + m_initialDarkBackground = m_viewManager->getGlobalDarkBackground(); - if (mode != Preferences::BackgroundFromTheme) { + + if (OSReportsDarkThemeActive()) { + // NB !(OSReportsDarkThemeActive()) doesn't necessarily mean + // the theme is light - the function also cunningly returns + // false if it has no way to tell + m_initialDarkBackground = true; + } + + if (mode == Preferences::BackgroundFromTheme) { + m_viewManager->setGlobalDarkBackground + (m_initialDarkBackground); + } else { m_viewManager->setGlobalDarkBackground (mode == Preferences::DarkBackground); } + #endif m_paneStack = new PaneStack(nullptr, m_viewManager, paneStackOptions);