linebender / xilem

An experimental Rust native UI framework
Apache License 2.0
3.61k stars 113 forks source link

White flash on app startup on Windows 11 dark mode #590

Open gfxenjoyer opened 1 month ago

gfxenjoyer commented 1 month ago

Xilem apps have a white flash on Windows even on dark mode. This does not happen on macOS. I suspect this has something to do with winit.

Hardware: OS: Windows 11 23H2 OS Build 22631.4169 CPU: Intel 12600k GPU: Nvidia RTX 3080 Driver 560.70

This also happens in Vello examples.

Reference Zulipchat

xilem_calc_white_flash_windows.webm

Edit: Calc build in video shown is a release build.

DJMcNab commented 1 month ago

Thanks for the report. I believe that there are a few things going on here:

Ultimately, I can't afford the time to dig into this at the moment, but hopefully this gives you some good directions to look towards when investigating this. In particular, you should try and find some documentation expressing a correct startup sequence for an app on Windows, or else perform some experiments (such as only making the window visible immediately before we call present for the first time - I am slightly concerned that rendering wouldn't be scheduled in that case...)

gfxenjoyer commented 1 week ago

egui had the same issue and fixed it by setting the window invisible until first render. https://github.com/emilk/egui/pull/3631

DJMcNab commented 2 days ago

A pr which experiments with that would be welcome!