sfx2/source/appl/appserv.cxx | 21 +++++++++++++++++---- sw/qa/extras/tiledrendering/tiledrendering.cxx | 6 +----- 2 files changed, 18 insertions(+), 9 deletions(-)
New commits: commit 12700ba4b529f36f1b8415801d7a345e1b5711e5 Author: Szymon Kłos <[email protected]> AuthorDate: Fri Feb 14 17:08:37 2025 +0100 Commit: Szymon Kłos <[email protected]> CommitDate: Wed Mar 5 06:09:37 2025 +0100 lok: switch dark mode faster We don't need to load the color scheme every time we switch the dark mode on/off. Let's load it once then reuse. - preloading - reuse instance Change-Id: I72478327124dad7142af826232f483e4033764e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181812 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182515 Tested-by: Szymon Kłos <[email protected]> Reviewed-by: Szymon Kłos <[email protected]> diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index f0c95f049e5c..a6b8bac2a119 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -383,6 +383,17 @@ weld::Window* SfxRequest::GetFrameWeld() const void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) { + const bool bIsLOK = comphelper::LibreOfficeKit::isActive(); + static svtools::EditableColorConfig aEditableConfig; + static bool aColorConfigInitialized = false; + if (!aColorConfigInitialized && bIsLOK) + { + // preload color schemes + aEditableConfig.LoadScheme("Light"); + aEditableConfig.LoadScheme("Dark"); + aColorConfigInitialized = true; + } + bool bDone = false; switch ( rReq.GetSlot() ) { @@ -738,16 +749,18 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) } MiscSettings::SetAppColorMode(nUseMode); } - svtools::EditableColorConfig aEditableConfig; + // kit explicitly ignores changes to the global color scheme, except for the current ViewShell, // so an attempted change to the same global color scheme when the now current ViewShell ignored // the last change requires re-sending the change. In which case individual shells will have to // decide if this color-scheme change is a change from their perspective to avoid unnecessary // invalidations. - if (!pNewThemeArg || comphelper::LibreOfficeKit::isActive() - || aEditableConfig.GetCurrentSchemeName() != sSchemeName) + if (!pNewThemeArg || bIsLOK || aEditableConfig.GetCurrentSchemeName() != sSchemeName) { - aEditableConfig.LoadScheme(sSchemeName); + if (bIsLOK) + aEditableConfig.SetCurrentSchemeName(sSchemeName); + else + aEditableConfig.LoadScheme(sSchemeName); } Invalidate(FN_CHANGE_THEME); diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 345a902ad507..26eed6a2b475 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -1288,11 +1288,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testGetViewRenderState) { SwView* pView = getSwDocShell()->GetView(); uno::Reference<frame::XFrame> xFrame = pView->GetViewFrame().GetFrame().GetFrameInterface(); - uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence( - { - { "NewTheme", uno::Any(u"Dark"_ustr) }, - } - ); + uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence({}); comphelper::dispatchCommand(u".uno:ChangeTheme"_ustr, xFrame, aPropertyValues); } CPPUNIT_ASSERT_EQUAL("S;Dark"_ostr, pXTextDocument->getViewRenderState());
