desktop/source/lib/init.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
New commits: commit d13b5f4d2eaa63cb94ba9e3603d49afa8ecf7c65 Author: Paris Oplopoios <paris.oplopo...@collabora.com> AuthorDate: Wed Jul 26 14:19:35 2023 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Aug 1 09:09:31 2023 +0200 Compare viewRenderState before setting view on doc_paintPartTile It shouldn't be the case that the view is changed upon painting a tile if the new view has different view options, as it may have a different theme (light/dark) Change-Id: Ie218ab1ca99a588cd04e93deb7b42a18b354b811 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154940 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 112b134b5e84..62107c0f7e57 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -4156,6 +4156,8 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, int nViewId = nOrigViewId; int nLastNonEditorView = -1; int nViewMatchingMode = -1; + SfxViewShell* pCurrentViewShell = SfxViewShell::Current(); + if (!isText) { // Check if just switching to another view is enough, that has @@ -4167,11 +4169,16 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, { bool bIsInEdit = pViewShell->GetDrawView() && pViewShell->GetDrawView()->GetTextEditOutliner(); - if (!bIsInEdit) + + OString sCurrentViewRenderState = pDoc->getViewRenderState(pCurrentViewShell); + OString sNewRenderState = pDoc->getViewRenderState(pViewShell); + + if (sCurrentViewRenderState == sNewRenderState && !bIsInEdit) nLastNonEditorView = pViewShell->GetViewShellId().get(); if (pViewShell->getPart() == nPart && pViewShell->getEditMode() == nMode && + sCurrentViewRenderState == sNewRenderState && !bIsInEdit) { nViewId = pViewShell->GetViewShellId().get(); @@ -4180,7 +4187,7 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, doc_setView(pThis, nViewId); break; } - else if (pViewShell->getEditMode() == nMode && !bIsInEdit) + else if (pViewShell->getEditMode() == nMode && sCurrentViewRenderState == sNewRenderState && !bIsInEdit) { nViewMatchingMode = pViewShell->GetViewShellId().get(); } @@ -4192,7 +4199,6 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, // if not found view with correct part // - at least avoid rendering active textbox, This is for Impress. // - prefer view with the same mode - SfxViewShell* pCurrentViewShell = SfxViewShell::Current(); if (nViewMatchingMode >= 0 && nViewMatchingMode != nViewId) { nViewId = nViewMatchingMode;