riverar / sample-win32-acrylicblur

Sample WPF Acrylic Blur app
https://withinrafael.com/2018/02/01/adding-acrylic-blur-to-your-windows-10-apps-redstone-4-desktop-apps/
MIT License
116 stars 7 forks source link

Lag when moving window (draging window with mouse) in Windows10 1903 #2

Closed ghost1372 closed 5 years ago

ghost1372 commented 5 years ago

hi when moving window (draging window with mouse) Hardly moves It seems to be having trouble with Windows10 1903 (18362) please watch this video

0000.zip

riverar commented 5 years ago

@ghost1372 Yup, this is a Windows bug in 1903. It also affects things like the emoji picker. Please upvote this issue in Feedback Hub https://aka.ms/AA4pzyf

As this doesn't directly affect the sample, going to close this.

ghost1372 commented 5 years ago

@riverar This bug seems to be fixed in version 1903 (18362.267)

riverar commented 5 years ago

@ghost1372 Not quite, this sample will still be laggy.

ghost1372 commented 5 years ago

@riverar You are right, but the emoji panel is fixed

tajbender commented 5 years ago

Hi, riverar,

Which emoji picker do you refeer to? The one I saw some time and somewhere in the taskbar?

However, any idea how I could detect if it is safe to use acrylic blur or not?

Thanks in advance, tajbender

hv0905 commented 4 years ago

Microsoft just removed Acrylic blur in emoji panel... This bug is still exist.

DoofyAss commented 4 years ago

Still lagging ( 1909, 18363.720 )

xmoer commented 4 years ago

Still lagging ( 2004, 19041.388 )

KitsuneAlex commented 3 years ago

Implemented this for my SDL based window toolkit. Still lagging on 2004 (19041.572).

KitsuneAlex commented 3 years ago

Still lagging on 20H2 (19041.572).

alexmercerind commented 3 years ago

I just noticed lag does not happen if you disable "Transparency effects" in Windows Settings. Did anyone try this on Windows 11?

delta1037 commented 3 years ago

@alexmercerind I try in Window 10 and that Disable "Transparency effects" in Windows Settings is useful

Window 10 21H1

ghost1372 commented 3 years ago

Anyone tested on windows 11?

tajbender commented 3 years ago

Anyone tested on windows 11?

Would be nice if someone would find the time.

not-nullptr commented 3 years ago

Anyone tested on windows 11?

Would be nice if someone would find the time.

Windows 11 user here. Still lagging with 1 - 2 second latency.

Windows 11 Build 22000

riverar commented 3 years ago

Acrylic is no longer used on most surfaces in Windows 11; switch to Mica (API coming soon).

ghost1372 commented 3 years ago

@riverar can you give us more details? Is Mica also supported in Windows 10? Or is it for Windows 11?

-- i found docs😁 Because it is available in WinUI, it is also available in Windows 10 (Right?)

riverar commented 3 years ago

According to this issue https://github.com/microsoft/microsoft-ui-xaml/issues/5265 it does not appear Mica will work downlevel and will fallback to a solid color. When the Win32 APIs are made available for Windows 11, you'll need to carefully craft your app to handle both scenarios.

alexmercerind commented 3 years ago

No lag on Windows 11. Bingo.

KeviinCosmos commented 3 years ago

No lag on Windows 11. Bingo.

One one of my computers (the best one), i have lag when i resize and move windows.. Can't figure out why. All drivers are in place. But it only happens when my explorer (this pc) is open. When i close the window. it works fine

jdmansour commented 3 years ago

In case somebody is still looking into this bug: Apparantly, you can work around it by throttling window move and resize events. See https://github.com/EYHN/vscode-vibrancy/discussions/80 . This is an Electron app, but I believe in win32 you could just drop some WM_MOVE events.

Here somebody reversed what the Acrylic (and Mica) effects do under the hood: https://github.com/Extrimis/Win32-Acrylic-Effect

TLDR: It uses DirectComposition. There are specific Visuals that you can create via undocumented APIs, that display the underlying Windows or the Desktop when compositing the Window. You can also add in blur layers, saturation, noise, and get something very close or identical to the original. At the moment there are some issues with calculating the background Visual's position when moving the window (and I believe this is also the cause of this bug). Also, I'm not sure if or how you can use DirectComposition on a WPF window, or if there are airspace issues... So currently it is more for intellectual curiosity than for anything else :-)

alexmercerind commented 3 years ago

I don't know how noone is talking about it...

But, latest build of Windows 11 (22000.100) actually makes ACCENT_ENABLE_ACRYLICBLURBEHIND completely opaque.

Builds below or equal to 22000.71 actually didn't lag and acrylic also worked as expected.

Seems they've nerfed it finally & don't want win32 apps to use that API for getting acrylic surfaces.

Maybe using XAML islands can be an option, see this example, they seem to be using c++/winRT: https://github.com/wangwenx190/Win32Acrylic (seeing this, adding mica won't be difficult I believe). I'm a no brainer in this case however, and using XAML islands always resulted in a crash for me.

alexmercerind commented 3 years ago

Just to tell everyone what I observed, earlier I used colors like Colors.white.withOpacity(0.10) (Color(0x1AFFFFFF)) but it results in opaque window now, I played with more colors, and noticed that color affects the behaviour differently.

Now Color(0x00F0F0F0) color looks like this (looks nearly same as start menu & taskbar surface):

alexxx So, no lag (even on top of file explorer) & it also seems to follow the "Enable transparency effects" & "Battery saver".