AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.18k stars 2.18k forks source link

Mica on Windows 11 22621.1992 does not work with certain desktop wallpaper #12237

Open chmckay opened 1 year ago

chmckay commented 1 year ago

Describe the bug I have a triple monitor Windows 11 system. I was initially thinking this was related to my GPUs, but cycling the desktop wallpaper between my monitors can cause the issue to move from monitor to monitor.

Specifically, when the the window is not focused on some wallpapers, there is no blurring of the background whatsoever (see the attached screenshot). When the window is focused, I see strange artifacts like solid blocks underneath some elements in spots, partially blurred segments and ghosted text. When I drag the window, the Mica zone flickers and flashes the wallpaper through the window. Windows dragged over the area occasionally leave artifacts about 100 pixels below the window being dragged. Taking a screenshot with the Windows Snipping tool yield the transparency issue. Using Print Screen renders the window as I would expect, so I took a photo with my phone (sorry for the quality).

I've double checked that I'm up-to-date on my drivers (Intel and nVidia). As a note, AcrylicBlur seems to work perfectly on everything. Since it appears to be wallpaper related, I'm not sure what I can add to that, other than provide copies of some of the wallpapers I'm using. Interestingly, this works perfectly on some wallpapers. Two of my monitors are connected to the Intel GPU and the third is connected to an nVidia T1200. I had initially thought it was the T1200, but when I changed wallpapers on that monitor, the issue disappeared. That same wallpaper displayed on a different monitor exhibited the same issue. Since Mica samples the desktop wallpaper and doesn't just blur, I can kind of understand why it's reliant on the wallpaper, but I don't understand why some wallpapers cause the issue. As an FYI, I use a combination of HD and 4k wallpapers, which are primarily nature photos.

To Reproduce

  1. Create a new Avalonia app with Avalonia 11.0.0
  2. Set the transparency hint to Mica, AcrylicBlur, Blur on the main window
  3. Create the recommended with an embedded ExperimentalAcrylicBorder embedded in it (using code from here

Expected behavior I'd like the Mica to render properly on Windows 11 devices.

Screenshots Unfocused window Unfocused Window

Focused window immediately after being dragged 20230717_142127

Both screenshots are running the same executable (with the transparency hint set to Mica,AcrylicBlur,Blue), just moved between monitors

Desktop (please complete the following information): HP zBook Studio 15.6 11th Gen Intel i7-11850H 32GB RAM 1TB NVME Builtin monitor: 1920x1080, 100% scaling (Intel GPU), 60.16Hz External monitor 1: (my primary) is 1920x1200, 100% scaling (Intel GPU), 59.95Hz External monitor 2: 1920x1080, 100% scaling (nVidia T1200 GPU), 60Hz

Additional context As mentioned above, AcrylicBlur works perfectly on this machine. It's just the Mica that's failing

maxkatz6 commented 1 year ago

Specifically, when the the window is not focused on some wallpapers, there is no blurring of the background whatsoever

It sounds like typical behavior for acrylic in UWP apps. And expected there. Not for Mica though.

Do you have the same issue with WinUI or UWP apps that use Mica?

chmckay commented 1 year ago

It sounds like typical behavior for acrylic in UWP apps. And expected there. Not for Mica though.

Do you have the same issue with WinUI or UWP apps that use Mica?

Not that I'm aware of. I've only ever seen this issue with my Avalonia app.

I did notice one more thing. I was originally thinking it was specific to a wallpaper, but cycling the wallpaper on any of the three monitors causes it to work, until I move the window to the new monitor.

chmckay commented 1 month ago

I'm about to upgrade to 11.1. Has this been addressed in that build?

timunie commented 1 month ago

@chmckay give it a try sure. But the issue is open and has the help wanted tag, so likely not fixed. If you have an idea how to do, a PR is welcome 🤗