Bug Report Flickering background if background image is set #1473

Closed
opened 2026-01-30 22:28:14 +00:00 by claunia · 9 comments
Owner

Originally created by @Summon528 on GitHub (Jun 1, 2019).

Environment

Windows build number: Microsoft Windows [Version 10.0.18362.145]
Windows Terminal version (if applicable): 880272c74

Any other software?

Steps to reproduce

  1. Set terminal to light theme
  2. Set a dark background image in a profile
  3. Open a new tab with that profile

Expected behavior

Actual behavior

Screen flickered
Imgur

Related to #853, probably because dxrender layer overwrites background image for a little bit amount of time

Originally created by @Summon528 on GitHub (Jun 1, 2019). <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: Microsoft Windows [Version 10.0.18362.145] Windows Terminal version (if applicable): 880272c74 Any other software? ``` # Steps to reproduce 1. Set terminal to light theme 2. Set a dark background image in a profile 3. Open a new tab with that profile <!-- A description of how to trigger this bug. --> # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> # Actual behavior Screen flickered [Imgur](https://i.imgur.com/K102pTf.gif) <!-- What's actually happening? --> Related to #853, probably because dxrender layer overwrites background image for a little bit amount of time
Author
Owner

@DHowett commented on GitHub (Jun 1, 2019):

This could also be #1082?

@DHowett commented on GitHub (Jun 1, 2019): This could also be #1082?
Author
Owner

@Summon528 commented on GitHub (Jun 1, 2019):

Actually I believe not, that one is happening when acrylic is on and background image is off. This one is the opposite. Also the draft fix (#1092) does not fix this one

@Summon528 commented on GitHub (Jun 1, 2019): Actually I believe not, that one is happening when acrylic is on and background image is off. This one is the opposite. Also the draft fix (#1092) does not fix this one
Author
Owner

@DHowett-MSFT commented on GitHub (Jun 1, 2019):

Perhaps the real issue in both #1082 and this issue is that the control is added to the UI tree before the background change is propagated into the renderer.

097f7d32a6/src/cascadia/TerminalControl/TermControl.cpp (L287-L289)

This function dispatches the background update into the settings/down into the renderer only after the root control's dispatcher has a free cycle, which will almost certainly be after it's been installed into the TermApp's content grid.

Good catch, @summon528.

@d-bingham If you don't mind terribly, would you consider this for #1092 as well? Let's try to knock out all the flashing bugs at once.

@DHowett-MSFT commented on GitHub (Jun 1, 2019): Perhaps the real issue in both #1082 and this issue is that the control is added to the UI tree before the background change is propagated into the renderer. https://github.com/microsoft/terminal/blob/097f7d32a632d2bc5480bdb17fff1fb2622c5e46/src/cascadia/TerminalControl/TermControl.cpp#L287-L289 This function dispatches the background update into the settings/down into the renderer only after the root control's dispatcher has a free cycle, which will almost certainly be after it's been installed into the TermApp's content grid. Good catch, @summon528. @d-bingham If you don't mind terribly, would you consider this for #1092 as well? Let's try to knock out all the flashing bugs at once.
Author
Owner

@d-bingham commented on GitHub (Jun 1, 2019):

Easy enough to add to #1092, but in fiddling with it for a few minutes I don't have much of a reproduction -- @Summon528 can you provide a profiles.json that shows it?

@d-bingham commented on GitHub (Jun 1, 2019): Easy enough to add to #1092, but in fiddling with it for a few minutes I don't have much of a reproduction -- @Summon528 can you provide a profiles.json that shows it?
Author
Owner

@DHowett-MSFT commented on GitHub (Jun 2, 2019):

Actually, yeah, I'm trying with this and I can't repro it:

        {
            "guid": "{dec46506-2b06-458e-975d-5f04d0b9927f}",
            "name": "Repro",
            "colorScheme": "URXVT",
	    "background": "#ff0000",
	    "backgroundImage": "C:\\windows\\system32\\FeatureToastBulldogImg.png",
            "historySize": 9001,
            "snapOnInput": true,
            "cursorColor": "#de00de",
            "cursorShape": "filledBox",
            "commandline": "cmd.exe",
            "fontFace": "Consolas",
            "fontSize": 12,
            "acrylicOpacity": 0.85,
            "useAcrylic": false,
            "closeOnExit": true,
            "padding": "8"
        },

maybe it needs to be a large image/something slow to load/something from a remote server? I see some very minor flickering when I use an image directly from the web.

@DHowett-MSFT commented on GitHub (Jun 2, 2019): Actually, yeah, I'm trying with this and I can't repro it: ```json { "guid": "{dec46506-2b06-458e-975d-5f04d0b9927f}", "name": "Repro", "colorScheme": "URXVT", "background": "#ff0000", "backgroundImage": "C:\\windows\\system32\\FeatureToastBulldogImg.png", "historySize": 9001, "snapOnInput": true, "cursorColor": "#de00de", "cursorShape": "filledBox", "commandline": "cmd.exe", "fontFace": "Consolas", "fontSize": 12, "acrylicOpacity": 0.85, "useAcrylic": false, "closeOnExit": true, "padding": "8" }, ``` maybe it needs to be a large image/something slow to load/something from a remote server? I see some very minor flickering when I use an image directly from the web.
Author
Owner

@d-bingham commented on GitHub (Jun 2, 2019):

I haven't been able to get the flicker on a new tab to happen reliably (with using an image over the network to introduce some sort of delay), but can get it to happen reliably by opening a tab and then closing it (causing the flicker to happen after the tab close but before the original tab is re-displayed).

From doing some testing the flicker is the default background brush (which will be white-ish in the Windows light theme and black-ish int he Windows dark theme) being drawn while it waits for the image to be loaded into the brush -- so if you've got a dark image in the dark theme it's not particularly noticeable, but it is definitely so with a dark image and a light theme.

Working on getting the async handling of image loading working a bit better by setting up a solid color brush on the background (using the profile's default background color) while waiting for the image to load, and keeping the image itself in the profile instead of each individual tab, so it can be reused effectively.

@d-bingham commented on GitHub (Jun 2, 2019): I haven't been able to get the flicker on a new tab to happen reliably (with using an image over the network to introduce _some_ sort of delay), but can get it to happen reliably by opening a tab and then closing it (causing the flicker to happen after the tab close but before the original tab is re-displayed). From doing some testing the flicker is the default background brush (which will be white-ish in the Windows light theme and black-ish int he Windows dark theme) being drawn while it waits for the image to be loaded into the brush -- so if you've got a dark image in the dark theme it's not particularly noticeable, but it is definitely so with a dark image and a light theme. Working on getting the async handling of image loading working a bit better by setting up a solid color brush on the background (using the profile's default background color) while waiting for the image to load, _and_ keeping the image itself in the profile instead of each individual tab, so it can be reused effectively.
Author
Owner

@Summon528 commented on GitHub (Jun 2, 2019):

maybe it needs to be a large image/something slow to load/something from a remote server? I see some very minor flickering when I use an image directly from the web.

I guess this is the key, cause I was loading a gif from the web 😜. I can also repro reliably even if the gif is in my local machine

        {
            "startingDirectory": "%USERPROFILE%",
            "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
            "name": "PowerShell",
            "background": "#012456",
            "colorScheme": "Campbell",
            "historySize": 9001,
            "snapOnInput": true,
            "cursorColor": "#FFFFFF",
            "cursorShape": "bar",
            "commandline": "powershell.exe",
            "fontFace": "Fira Code",
            "fontSize": 12,
            "acrylicOpacity": 0.5,
            "useAcrylic": false,
            "closeOnExit": true,
            "padding": "0, 0, 0, 0",
            "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
            "backgroundImage": "https://i.imgur.com/Yaf1Axq.gif",
            "backgroundImageOpacity": 1
        }
@Summon528 commented on GitHub (Jun 2, 2019): > maybe it needs to be a large image/something slow to load/something from a remote server? I see some very minor flickering when I use an image directly from the web. I guess this is the key, cause I was loading a gif from the web 😜. I can also repro reliably even if the gif is in my local machine ```json { "startingDirectory": "%USERPROFILE%", "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", "name": "PowerShell", "background": "#012456", "colorScheme": "Campbell", "historySize": 9001, "snapOnInput": true, "cursorColor": "#FFFFFF", "cursorShape": "bar", "commandline": "powershell.exe", "fontFace": "Fira Code", "fontSize": 12, "acrylicOpacity": 0.5, "useAcrylic": false, "closeOnExit": true, "padding": "0, 0, 0, 0", "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png", "backgroundImage": "https://i.imgur.com/Yaf1Axq.gif", "backgroundImageOpacity": 1 } ```
Author
Owner

@zadjii-msft commented on GitHub (Mar 8, 2022):

FWIW, I can still repro this on 1.14, but I'm not sure there's much else that can be done here. We now at least open the control with the configured background color, but the image still takes a few frames to load. I don't really think it's a good idea to hold off creation of the control until the image is loaded. I don't think there's a way to get some sort of placeholder BG color from the image before it loads, cause obviously we need to load the image first.

@Summon528 you mind if we close this one out now?

@zadjii-msft commented on GitHub (Mar 8, 2022): FWIW, I can still repro this on 1.14, but I'm not sure there's much else that can be done here. We now at least open the control with the configured background color, but the image still takes a few frames to load. I don't really think it's a good idea to hold off creation of the control until the image is loaded. I don't think there's a way to get some sort of placeholder BG color from the image before it loads, cause obviously we need to load the image first. @Summon528 you mind if we close this one out now?
Author
Owner

@Summon528 commented on GitHub (Mar 9, 2022):

Yeah sure, it's way less annoying now

@Summon528 commented on GitHub (Mar 9, 2022): Yeah sure, it's way less annoying now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1473