-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why does a white background appear when Lapce or Floem Application is launched, and how can it be eliminated? #468
Comments
You may want to note what OS + version plus version of floem you are running, as how unused parts of windows are painted can be platform-dependent. I've noticed (I'm not an author of floem, just have contributed a few patches), that the So there probably is something to address here regarding how the root view is styled. I believe the white you are seeing is the default theme, which is dark-on-light - probably whatever you put in the window has a fixed size, so that part is white and the rest is whatever the OS paints underneath as the window background in non-transparent mode (Mac OS dark them I'm guessing?) |
@timboudreau Thank you for your reply; The following is environment information。
Running Lapce (All release version ) also results in a white background appearing, as shown in the image. |
I'm not going to have any ideas about Windows - too many years working at Sun Microsystems where installing Windows was a firing offense... I spent some time this afternoon attempting and failing to get transparent windows actually working on Mac OS, and ran into similar issues - there's something that really wants to paint the windows white or black (if transparent) that's below the level where Floem does anything (it does pass the transparent flag through to winit - I verified that). Some googling showed up a set of flags passed to MacOS by winit via wgpu that determine whether the window has an alpha channel at all. Might be an avenue to look at here as well. Though it may simply be that you need to style your bottommost view with fill_width() and fill_height() and you're just getting the root view (container Floem puts your views in in the window) background because your component doesn't fully cover it. Try that, in fact. |
specifically for getting transparent windows it has to do with the alpha mode here. Different setting affect different platforms in different ways. I don't understand everything about those settings but I have previously used them to get a transparent window |
Good to know. I can try to get it happy on Mac OS and Linux/X11 (maybe even Wayland if I want to futz with rebuilding it with different flags - I'm on a circa 2016 Broadwell CPU with a somewhat buggy GPU there). But I have no recourse for testing on Windows. |
I debugged winit on Windows and found the same problem, just after the window is created. According to MS docs, we need to set window's background in https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-wndclassa |
How can I solve this problem? Is there anyone who can provide suitable suggestions? |
It's already transparent, there is no need to pass anything |
But that's the issue. We don't always want it to be transparent. Setting this clear color to a specific value will make the window clear to that color when initializing (I think). |
We do, otherwise you will get either different colours between the app itself and what you provide in |
I'm pretty sure the issues with white window flash at the start are related to the backend used and/or transparency mode used. |
This bug is also exist in Lapce all versions Release . |
Lapce uses Floem, so all issues in Floem will be present in Lapce |
FWIW, on Mac OS with a transparent window background set and the flag for a transparent window set when creating the window, you get a window with a black background. So I think something is amiss with window initialization, though it may or may not be related to this issue on Windows. I've tried patching it a few different ways but have not found a fix yet. In researching it, I ran across a comment on a bug report for something using winit saying that winit's implementation of NSView was missing some properties introduced more recently or trying to use properties that are no longer used. I don't know the accuracy of that but it might be a thing you check for solving window background issues Mac OS. |
Finally fixed this on winit: Long0x0/winit@23722ea. The window will remain transparent until drawn by floem. Could you check if this works? |
Great, this has fixed the issue, and I've tested it on Windows 11. Hope it gets merged into the main branch soon. |
As shown in the above image, there is a white background that appears upon startup; it's very unsightly and affects the visual experience. It is recommended to eliminate it.
The text was updated successfully, but these errors were encountered: