cui/source/options/appearance.cxx | 2 ++ include/vcl/themecolors.hxx | 20 ++++++++++++++++++++ svtools/source/config/colorcfg.cxx | 3 ++- vcl/source/app/themecolors.cxx | 1 + 4 files changed, 25 insertions(+), 1 deletion(-)
New commits: commit adb66f91ee91656540e12fc0df82313916f53eb6 Author: Sahil Gautam <[email protected]> AuthorDate: Fri Jan 30 21:46:39 2026 +0530 Commit: Sahil Gautam <[email protected]> CommitDate: Mon Feb 2 12:13:55 2026 +0100 fix: don't disable theming once enabled by restartdlg In appearance.cxx, we show the restart dialog when the user changes the appearance modes. And before showing the restart dialog, we temporarily enable application theming so that the dialog's widgets are drawn with the old appearance colors and not a mix of old and new (which make it unreadable). But when some module is open, there a lot of DoPaint calls which create ColorConfig instances and call SetupTheme. There because it's automatic theme, the theme is disabled. As a result, restart dialog is drawn partially with the old appearance colors and partially with the new appearance colors, appearning broken. `m_bRestartDialogShown` is a way of preventing SetupTheme from disabling application theming even if it's Automatic theme. This is just a quick fix for co-25.04. Change-Id: I44c41738dfeab1552e461ed0cd15b643736fdedd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198437 Reviewed-by: Sahil Gautam <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/cui/source/options/appearance.cxx b/cui/source/options/appearance.cxx index 9ef741212e47..278dc1f177ef 100644 --- a/cui/source/options/appearance.cxx +++ b/cui/source/options/appearance.cxx @@ -21,6 +21,7 @@ #include <tools/debug.hxx> #include <unotools/resmgr.hxx> #include <vcl/svapp.hxx> +#include <vcl/themecolors.hxx> #include <comphelper/dispatchcommand.hxx> #include <comphelper/propertyvalue.hxx> #include <map> @@ -147,6 +148,7 @@ SvxAppearanceTabPage::~SvxAppearanceTabPage() if (m_bRestartRequired) { pColorConfig->TemporarilyLoadAndEnableThemes(); + ThemeColors::m_bRestartDialogShown = true; ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(), GetFrameWeld(), svtools::RESTART_REASON_THEME_CHANGE); } diff --git a/include/vcl/themecolors.hxx b/include/vcl/themecolors.hxx index 80f56db5e0e4..a13fb35eaa9a 100644 --- a/include/vcl/themecolors.hxx +++ b/include/vcl/themecolors.hxx @@ -17,6 +17,26 @@ class VCL_DLLPUBLIC ThemeColors static bool m_bIsThemeLoaded; static ThemeColors m_aThemeColors; +public: + /* + * In appearance.cxx, we show the restart dialog when the user + * changes the appearance modes. And before showing the restart + * dialog, we temporarily enable application theming so that the + * dialog's widgets are drawn with the old appearance colors and + * not a mix of old and new (which make it unreadable). + * + * But when some module is open, there a lot of DoPaint calls which + * create ColorConfig instances and call SetupTheme. There because + * it's automatic theme, the theme is disabled. As a result, restart + * dialog is drawn partially with the old appearance colors and + * partially with the new appearance colors, appearning broken. + * + * `m_bRestartDialogShown` is a way of preventing SetupTheme from + * disabling application theming even if it's Automatic theme. This + * is just a quick fix for co-25.04. + */ + static bool m_bRestartDialogShown; + public: static ThemeColors& GetThemeColors() { return m_aThemeColors; } static void SetThemeColors(const ThemeColors& rThemeColors) { m_aThemeColors = rThemeColors; } diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index 0e52bc75598d..31974925964f 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -482,7 +482,8 @@ void ColorConfig::SetupTheme() if (!officecfg::Office::Common::Appearance::LibreOfficeTheme::get() || ThemeColors::IsAutomaticTheme(GetCurrentSchemeName())) { - ThemeColors::SetThemeLoaded(false); + if (!ThemeColors::m_bRestartDialogShown) + ThemeColors::SetThemeLoaded(false); return; } diff --git a/vcl/source/app/themecolors.cxx b/vcl/source/app/themecolors.cxx index b46fdee33e8d..6474934a4fae 100644 --- a/vcl/source/app/themecolors.cxx +++ b/vcl/source/app/themecolors.cxx @@ -10,5 +10,6 @@ ThemeColors ThemeColors::m_aThemeColors; bool ThemeColors::m_bIsThemeLoaded = false; +bool ThemeColors::m_bRestartDialogShown = false; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
