Bug 164886 - "Image as application background" in the new UI theme feature doesn't work
Summary: "Image as application background" in the new UI theme feature doesn't work
Status: NEEDINFO
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
25.2.0.1 rc
Hardware: All All
: medium normal
Assignee: Sahil Gautam (allotropia)
URL:
Whiteboard: target:25.8.0 target:25.2.1
Keywords:
: 165146 (view as bug list)
Depends on:
Blocks: UI-Theming LibreOffice-Themes
  Show dependency treegraph
 
Reported: 2025-01-28 08:31 UTC by Ming Hua
Modified: 2025-04-07 13:37 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ming Hua 2025-01-28 08:31:35 UTC
The revamped UI theme feature in version 25.2 added the possibility of setting an image as the background of the whole application.  However it doesn't seem to work for me on Windows 11.

Steps to Reproduce:
1. Tools > Options > LibreOffice > Appearance page, use "New" button to create a new theme.

2. In "Customizations" section, choose "Application background" for Items, then choose "Image" radio button, and pick any image.

3. Press "Apply" or "OK" button, restart LibreOffice if needed.

Expected Result:
See selected image in place of the gray background outside of the page area.

Actual Result:
Nothing changes, still the gray background.

Version Information:
Version: 25.2.0.3 (X86_64) / LibreOffice Community
Build ID: e1cf4a87eb02d755bce1a01209907ea5ddc8f069
CPU threads: 12; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Raster; VCL: win
Locale: zh-CN (zh_CN); UI: en-US
Calc: CL threaded

Also tried zh-CN UI. This feature never worked for me, and I tested 25.2.0 RC1 and RC2.
Comment 1 Ming Hua 2025-01-28 08:37:42 UTC
This new "Appearance" page doesn't have its own meta bug yet, so I'll just add UI-Theming as the meta bug and put #163620 in See Also.
Comment 2 Heiko Tietze 2025-01-28 10:01:13 UTC
Have you played with the stretched vs. filled option? The feature works for me not only in Linux but also on Windows, see https://design.blog.documentfoundation.org/2024/12/20/libreoffice-themes-will-replace-the-color-customization/
Comment 3 Ming Hua 2025-01-28 11:34:19 UTC
(In reply to Heiko Tietze from comment #2)
> Have you played with the stretched vs. filled option?
Just tried stretched option, still doesn't work.

Also tried safe mode (so no Skia), doesn't work either.

One difference could be that my 25.2 version was installed via "msiexec /a" command, which installs on D: drive and doesn't write registry.

FWIW, the color options of this new theme feature work fine, including setting application background to a new color. Setting images as page background in Format > Page Style > Area > Image also works.
Comment 4 Regina Henschel 2025-01-28 12:37:53 UTC
I does not work with Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 85c8901dc2710e91bccb64cd7d8068441f42f65b
CPU threads: 32; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc: threaded
Comment 5 Sahil Gautam (allotropia) 2025-01-28 14:02:41 UTC
The reason is that Themes is disabled by default and just changing the theme won't work. The user also has to enable it from the expert configuration. The registry entry is LibreOfficeTheme, set it to 1 to enable.

Pushed a patch to master for enabling themes by default + some UI changes https://gerrit.libreoffice.org/c/core/+/179406.

Added Sophie and Olivier as reviewers as the patch has a string change which might be a blocker for cherry-picking it to 25-2-1.
Comment 6 Heiko Tietze 2025-02-10 07:34:26 UTC
*** Bug 165146 has been marked as a duplicate of this bug. ***
Comment 7 Heiko Tietze 2025-02-10 07:35:01 UTC
(In reply to Sahil Gautam (allotropia) from comment #5)
> Pushed a patch to master...

Fixed?
Comment 8 Sahil Gautam (allotropia) 2025-02-10 09:18:52 UTC
I tried with 25.2.0.1, 25.2.0.2, 25.2.0.3 but couldn't reporduce the issue. Interestingly I was able to reproduce it in my installation. I still don't know what's wrong with it as it's working for all the 25.2 release candidate dev branches. will look into it, if I can find anything.

Version: 25.2.0.3 (X86_64) / LibreOffice Community
Build ID: e1cf4a87eb02d755bce1a01209907ea5ddc8f069
CPU threads: 32; OS: Windows 11 X86_64 (10.0 build 22631); UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded

next I will use a bibisect repo to see if I can find the cause :)
Comment 9 Buovjaga 2025-02-10 15:12:51 UTC
I confirm the problem in an installed 25.8 even with LibreOfficeTheme set to 1. Resetting entire profile does not help.

Problem is NOT seen in Windows bibisect repo for 25.8. Checked commit ddeeca35d9630f2d3d3afb83a2ec8f21458f6e19 and master.

No idea what could have an effect here on the difference.

This is the tinderbox build where the problem is seen: https://ci.libreoffice.org/job/lo_tb_master_win/lastBuild/console

This is the bibisect build, but it doesn't show any build options: https://ci.libreoffice.org/job/lo_bibisect_win32_25_8/lastBuild/console

Xisco: do you have an idea about the difference or how we could compare the build options? Are the bibisect builds also done with VS 2019?
Comment 10 Vladymir 2025-02-10 21:31:22 UTC
please keep in mind that this bug is not Windows only. 
I reported it in issue #165146 for Ubuntu but it was closed as a duplicate of this one.
Comment 11 Sahil Gautam (allotropia) 2025-02-11 11:18:51 UTC
I can reproduce this in 
Version: 25.2.0.3 (X86_64) / LibreOffice Community
Build ID: e1cf4a87eb02d755bce1a01209907ea5ddc8f069
CPU threads: 32; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Flatpak
Calc: threaded

and 

Version: 25.2.0.3 (X86_64) / LibreOffice Community
Build ID: 520(Build:3)
CPU threads: 32; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

first one is flatpak installation, and the second one is my local distro installation. I suspect it might be debug mode vs release mode issue, although I couldn't find anything on latest master (release mode).
Comment 12 Buovjaga 2025-02-11 11:37:21 UTC
(In reply to Sahil Gautam (allotropia) from comment #11)
> first one is flatpak installation, and the second one is my local distro
> installation. I suspect it might be debug mode vs release mode issue,
> although I couldn't find anything on latest master (release mode).

Can't be due to debug build as the Win master build I used is not debug.
Comment 13 Sahil Gautam (allotropia) 2025-02-11 19:34:33 UTC
(In reply to Buovjaga from comment #12)
> (In reply to Sahil Gautam (allotropia) from comment #11)
> > first one is flatpak installation, and the second one is my local distro
> > installation. I suspect it might be debug mode vs release mode issue,
> > although I couldn't find anything on latest master (release mode).
> 
> Can't be due to debug build as the Win master build I used is not debug.

Thorsten suggested to debug the installation by getting the debug symbols, and attaching the debugger to the process, and thanks to that I found the problematic code.

this is the function responsible for drawing the application background bitmap. it's present in `sw/source/core/view/viewsh.cxx`. if this function returns true, the color background drawing is skipped, and if it returns false, color is drawn instead.

```
bool SwViewShell::DrawAppBackgroundBitmap(vcl::RenderContext* rRenderContext, const SwRect& rRect)
```
On the installation, this conditional always passes for some reason, and we return false which causes this bug (color is drawn instead of bitmap).

```
    if (Application::IsHeadlessModeEnabled()
        || !ThemeColors::GetThemeColors().GetAppBackUseBitmap())
        return false;
```
Comment 14 Sahil Gautam (allotropia) 2025-02-12 17:57:28 UTC
so after debugging the binary with raw gdb, I started with a clean slate, I thought of just removing libreoffice and all it's dependencies but accidentally broke my system which forced me to get a new slate (reinstall the system). this time while installing my dotfiles, I commented libreoffice, so really clean. Then I cloned my distribution's package manager repository and built libreoffice locally and installed it from the local build. What did I find? when I run it from the terminal (the binary from the path /usr/bin/libreoffice), app background bitmap customization doesn't work, but when I run it from the source code repository (like ./instdir/program/soffice) which the package manger built from, it runs as  expected, the app background bitmap customization works

this implies that there is something wrong with other components of the installation, not the binary ==> rules out the "compiler optimizes out important logic" argument
Comment 15 Sahil Gautam (allotropia) 2025-02-17 12:25:11 UTC
marking as resolved fixed as https://gerrit.libreoffice.org/c/core/+/181520 fixes it.
Comment 16 Commit Notification 2025-02-18 10:58:01 UTC
Sahil Gautam committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0434700e36440082c9f23bb591924d9f57f449aa

tdf#164886 register gallery/backgrounds with scp2

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Commit Notification 2025-02-18 12:02:34 UTC
Sahil Gautam committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/f23d3233ed3f2f5f5052a5777a4f79e699531f0e

tdf#164886 register gallery/backgrounds with scp2

It will be available in 25.2.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Commit Notification 2025-02-18 13:06:46 UTC
Sahil Gautam committed a patch related to this issue.
It has been pushed to "libreoffice-25-2-1":

https://git.libreoffice.org/core/commit/6ffa29e61df4f2acae847cd41205f82be9634fca

tdf#164886 register gallery/backgrounds with scp2

It will be available in 25.2.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Ming Hua 2025-02-25 00:45:23 UTC
I confirm that setting images as application background works for:

Version: 25.2.1.2 (X86_64) / LibreOffice Community
Build ID: d3abf4aee5fd705e4a92bba33a32f40bc4e56f49
CPU threads: 12; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Vulkan; VCL: win
Locale: zh-CN (zh_CN); UI: zh-CN
Calc: CL threaded

Thanks Sahil for the fix and everyone for helping!
Comment 20 Vladymir 2025-02-26 21:17:20 UTC
fixed! 

Version: 25.2.1.2 (X86_64) / LibreOffice Community
Build ID: d3abf4aee5fd705e4a92bba33a32f40bc4e56f49
CPU threads: 8; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: ru-RU (ru_RU.UTF-8); UI: ru-RU
Calc: threaded
Comment 21 Henning 2025-04-07 13:20:11 UTC
Issue persists on Windows 10 with LO 25.2.2.2.

I could set the application background image to "Eislicht" on my German installation (probably "ice light" in English) exactly once, but after restarting it wouldn't work anymore. Setting it back to a colour and then to an image does not work.

Version: 25.2.2.2 (X86_64) / LibreOffice Community
Build ID: 7370d4be9e3cf6031a51beef54ff3bda878e3fac
CPU threads: 4; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Raster; VCL: win
Locale: de-DE (en_DE); UI: de-DE
Calc: CL threaded
Comment 22 V Stuart Foote 2025-04-07 13:37:06 UTC
(In reply to Henning from comment #21)
> Issue persists on Windows 10 with LO 25.2.2.2.
> 
> I could set the application background image to "Eislicht" on my German
> installation (probably "ice light" in English) exactly once, but after
> restarting it wouldn't work anymore. Setting it back to a colour and then to
> an image does not work.
> 
> Version: 25.2.2.2 (X86_64) / LibreOffice Community
> Build ID: 7370d4be9e3cf6031a51beef54ff3bda878e3fac
> CPU threads: 4; OS: Windows 10 X86_64 (10.0 build 19045); UI render:
> Skia/Raster; VCL: win
> Locale: de-DE (en_DE); UI: de-DE
> Calc: CL threaded

Have you installed and activated an Appearance theme extension?

If not, and you remain in 'Automatic' with os/DE defaults the background will not take.

Please enable an Appearance theme extension and retest. But be aware to get back fully to os/DE defaults you will need to clear profile and allow it to rebuild.