# HG changeset patch # User Chris Cannam # Date 1579540809 0 # Node ID de79698944025eaf062e5f8587b461f982c3c1ce # Parent a39538eaed9d4a9a96b4a3d619675bc31f480e12 Fix initial dark background flag when OS theme indicates something different to the facts on the ground diff -r a39538eaed9d -r de7969894402 framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Fri Jan 17 21:38:43 2020 +0000 +++ b/framework/MainWindowBase.cpp Mon Jan 20 17:20:09 2020 +0000 @@ -212,16 +212,27 @@ SVDEBUG << "MainWindowBase: View font size is " << viewFontSize << endl; #ifndef Q_OS_MAC + Preferences::BackgroundMode mode = Preferences::getInstance()->getBackgroundMode(); - if (mode == Preferences::BackgroundFromTheme && OSThemeIsDark()) { - mode = Preferences::DarkBackground; + + m_initialDarkBackground = m_viewManager->getGlobalDarkBackground(); + + 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; } - m_initialDarkBackground = m_viewManager->getGlobalDarkBackground(); - if (mode != Preferences::BackgroundFromTheme) { + + 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);