Mercurial > hg > svapp
changeset 734:de7969894402 background-mode
Fix initial dark background flag when OS theme indicates something different to the facts on the ground
author | Chris Cannam |
---|---|
date | Mon, 20 Jan 2020 17:20:09 +0000 |
parents | a39538eaed9d |
children | fda54e91ca05 |
files | framework/MainWindowBase.cpp |
diffstat | 1 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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);