Open Bug 1850979 Opened 9 months ago Updated 7 days ago

No way to achieve transparent window backdrop on Windows 10/11 in Firefox 117

Categories

(Core :: Widget: Win32, defect)

Firefox 117
defect

Tracking

()

ASSIGNED

People

(Reporter: maximtsyba, Assigned: emilio)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

Steps to reproduce:

-moz-windows-borderless-glass appearance flag was actively used by many custom CSS themes to achieve fully transparent window's backdrop and make system's window decoration visible. For example, it was the only way to get working Mica effect for Firefox with the help of MicaForEveryone utility on Windows 11.

Actual results:

Since Firefox dropped support for Windows 7/8 in version 115 (for which -moz-windows-borderless-glass appearance was initially developed for), this flag was considered dead code and removed in FF 117, leaving no other way to achieve full transparency for Firefox window.

Expected results:

Given that the -moz-windows-borderless-glass flag was not used for its original intended purpose, it makes sense to add a new appearance flag that would provide the desired functionality (completely disabling any window backdrop on Windows 10/11), while not having all the redundant code designed to display the effects of Aero (which indeed became obsolete with the drop of support for Windows 7/8).

Flags: needinfo?(emilio)

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: WebRender' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: WebRender
Product: Firefox → Core
See Also: → 1844241

So bug 1844241 removed a bunch of win7-specific code that when used in win10 caused this transparent effect but I'm pretty sure after staring a bit at this code that this is not the best way to support semi-transparent windows.

Setting transparent background on the root will completely disable acceleration, see this code.

Sotaro, are you the right person to ask about dcomp? The comment above seems largely outdated. Do you know how much work would it be to support accelerated transparent windows on Windows 10+?

Thanks.

Flags: needinfo?(emilio) → needinfo?(sotaro.ikeda.g)

This brings back some of the glass code and implements the windows 11
mica effect.

It kinda works, but not fully. Resizing and maximized windows don't
quite work, and there's the XUL window behind.

I looked a bit more into it to see what would it take to get Windows 11 mica effect working properly.

It seems it kinda should work with something along the lines of the above, but the Dwm calls aren't quite perfect...

See Also: → 1851155
See Also: → 1764822

:emilio, how did you confirmed the patch? I tried to test the patch during enabling Backdrop Type "Acrylic" with "Mica For Fveryone", I did not saw glass effect with latest m-c.

Flags: needinfo?(sotaro.ikeda.g) → needinfo?(emilio)

Attachment 9351498 [details] happened when pref gfx.webrender.compositor=false. With it, swap chain of RenderCompositorANGLE was used.

During pref gfx.webrender.compositor=true, "application menu" was rendered as expected. With gfx.webrender.compositor=true, swap chain is not used, instead DirectComposition surfaces are used for rendering.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #2)

Sotaro, are you the right person to ask about dcomp?

Yes. But it seemed that we needs to spend more time in non-dcomp rendering. On Windows 10, high contrast theme used window transparency like Bug 1570879 in the past. In this case, DCLayerTree did not need code change.

Windows11 has the following ways to render. We need to check each.
-[1] DComp with Surfaces (DCLayerTree)
-[2] DComp with SwapChain (RenderCompositorANGLE)
-[3] SwapChain without Dcomp (RenderCompositorANGLE)
-[4] Software WebRender with CompositorD3D11 (RenderCompositorD3D11SWGL)
-[5] Software WebRender (RenderCompositorSWGL)

The comment above seems largely outdated. Do you know how much work would it be to support accelerated transparent windows on Windows 10+?

It seemed that necessary gfx change could be around Bug 1570879 change. But we do not know yet how much regressions we are going to face. So how much work is needed remains to be seen.

Flags: needinfo?(emilio)

(In reply to Sotaro Ikeda [:sotaro] from comment #5)

:emilio, how did you confirmed the patch? I tried to test the patch during enabling Backdrop Type "Acrylic" with "Mica For Fveryone", I did not saw glass effect with latest m-c.

You shouldn't need mica-for-everyone or anything else to see mica with the patch I attached. But yeah it was basically a dumb proof of concept so I wouldn't be surprised there are issues. I also enabled acceleration for popups which is what shows that border.

But the tldr is that handling of transparent windows is broken (and has for quite a while), regardless of mica. If you remove the Dwm call from my patch you're supposed to use the transparent backdrop effect in the titlebar, but it's not quite so easy it seems.

The severity field is not set for this bug.
:gw, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(gwatson)
Severity: -- → S3
Flags: needinfo?(gwatson)
Attached image image.png

Tried applying this on top of the latest m-c (required manual rebase), did I do something wrong? 🤔

Blocks: wr-todos

I updated this so that it can be more reliable, can you try it out?

I disabled the XUL Skeleton UI so that it didn't come into play here, but I'm sure this could be made to work.

Quirks I'm aware of is that there are some redundant native titlebar buttons behind ours, and it quirks on resize, but I'm assuming that's fixable, somehow...

Flags: needinfo?(krosylight)
Component: Graphics: WebRender → Widget: Win32

Okay, fixed those two things I think, though not landable as-is.

I just tried it and it works nice 🎉! Except some caveats:

  1. It now shows a full blank Mica acrylic window with nothing in it before showing full Firefox UI 👀
  2. Double-click-to-maximize is now broken
Flags: needinfo?(krosylight)

(In reply to Kagami Rosylight [:saschanaz] (they/them) from comment #14)

  1. It now shows a full blank Mica acrylic window with nothing in it before showing full Firefox UI 👀

Yeah, expected for now because of the XUL pre-skeleton UI stuff.

  1. Double-click-to-maximize is now broken

I can look into this.

Depends on: 1891063

This ideally should not be observable until you have transparent windows, in
which case the window buttons will show up behind Gecko's content.

However this breaks tiling on windows 11 and double-click to maximize and so
on. So we want a different solution...

Depends on D207302

Doesn't seem to be needed, but stashing here for posterity in case it ends up
being needed.

Depends on D207303

Attachment #9396299 - Attachment description: WIP: Bug 1850979 - Hide popup buttons when setting 0 top client margin. → WIP: Bug 1850979 - Hide titlebar buttons when setting 0 top client margin.
Assignee: nobody → emilio
Attachment #9396299 - Attachment description: WIP: Bug 1850979 - Hide titlebar buttons when setting 0 top client margin. → Bug 1850979 - Hide caption buttons when setting 0 top client margin. r=#win-reviewers
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
See Also: → 1892835
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: