No way to achieve transparent window backdrop on Windows 10/11 in Firefox 117
Categories
(Core :: Widget: Win32, defect)
Tracking
()
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).
Reporter | ||
Updated•9 months ago
|
Comment 1•9 months ago
|
||
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.
Assignee | ||
Comment 2•9 months ago
|
||
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.
Assignee | ||
Comment 3•9 months ago
|
||
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.
Assignee | ||
Comment 4•9 months ago
|
||
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...
Comment 5•9 months ago
•
|
||
: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.
Comment 6•9 months ago
|
||
Comment 7•9 months ago
|
||
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.
Comment 8•9 months ago
|
||
(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.
Assignee | ||
Comment 9•9 months ago
|
||
(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.
Comment 10•8 months ago
|
||
The severity field is not set for this bug.
:gw, could you have a look please?
For more information, please visit BugBot documentation.
Updated•8 months ago
|
Comment 11•8 months ago
|
||
Tried applying this on top of the latest m-c (required manual rebase), did I do something wrong? 🤔
Assignee | ||
Comment 12•1 month ago
|
||
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...
Updated•1 month ago
|
Assignee | ||
Comment 13•1 month ago
|
||
Okay, fixed those two things I think, though not landable as-is.
Comment 14•1 month ago
|
||
I just tried it and it works nice 🎉! Except some caveats:
- It now shows a full blank Mica acrylic window with nothing in it before showing full Firefox UI 👀
- Double-click-to-maximize is now broken
Assignee | ||
Comment 15•1 month ago
|
||
(In reply to Kagami Rosylight [:saschanaz] (they/them) from comment #14)
- 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.
- Double-click-to-maximize is now broken
I can look into this.
Assignee | ||
Comment 16•1 month ago
|
||
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
Assignee | ||
Comment 17•1 month ago
|
||
Doesn't seem to be needed, but stashing here for posterity in case it ends up
being needed.
Depends on D207303
Updated•1 month ago
|
Comment 18•1 month ago
•
|
||
Might be worth checking Chromium implementation too:
- Part of the code https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/views/frame/browser_frame_view_win.cc;l=678-692;drc=c3a7009be69ddc4492e8bb4e6dcb12bb0b1d3b71;bpv=1;bpt=1
- The full commit https://source.chromium.org/chromium/chromium/src/+/e7304f7eca9ce82d42a48ae2ce19f48f50be051c
Updated•26 days ago
|
Description
•