ysc3839 / win32-darkmode

Example application shows how to use undocumented dark mode API introduced in Windows 10 1809.
MIT License
437 stars 48 forks source link

Support windows insiders fast ring? #2

Closed davidhewitt closed 4 years ago

davidhewitt commented 4 years ago

Thanks for the example code, very useful!

I'm on windows insiders fast ring (currently build 19023). The following line appears to no longer work on my system:

https://github.com/ysc3839/win32-darkmode/blob/ed8480f1c98cf4c3193babde9c342d0aae1bdbf5/win32-darkmode/DarkMode.h#L77

What I've found (through a bit of experimentation) is that the constant 19 needs to instead be 20 on my system. If I change that line accordingly, then this example works as expected on my system.

I guess a build version check might be needed and switch the constant at runtime accordingly?

LeoDavidson commented 4 years ago

It's interesting to note Microsoft themselves have published code using 19 as the constant here: terminal/windowtheme.cpp

If they're breaking their own public, published code now, maybe it's really a bug in the Insider build that should be reported & fixed in the OS before it makes it to proper release versions? (That's the point of Insider builds, I would have thought, to test things and report bugs in the OS itself. And then Microsoft ignore everything, and still fail to document anything, of course. :) )

davidhewitt commented 4 years ago

Good idea; I reported it on the Insiders "Feedback Hub": https://aka.ms/AA6lz3k

ysc3839 commented 4 years ago

I will have a look when I have time. By the way, I remembered only open/save dialog has dark titlebar. However in 1909 it is normal titlebar. I guess this feature is to be removed?

ysc3839 commented 4 years ago

Just tested in 1909, both 19 and 20 doesn't work.

ysc3839 commented 4 years ago

That is my mistake. I set HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\AccentColorInactive, which overrides dark titlebar color in 1909, but not in 1809.

davidhewitt commented 4 years ago

I set HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\AccentColorInactive, which overrides dark titlebar color in 1909, but not in 1809.

So if I understand correctly, you're on 1909 at the moment, and observing that 19 is still the correct constant to use on your system?

ysc3839 commented 4 years ago

@davidhewitt Yes.

ysc3839 commented 4 years ago

I confirmed that in 19028 the attribute constant is 20. I also found that this effect is done by SetPropW UseImmersiveDarkModeColors in 1809. And since 1903 it changed to SetWindowCompositionAttribute system call (other attributes are using this too).

davidhewitt commented 4 years ago

Great, thanks for investigating! Do you think it's worth supporting insider builds in this example? Or will you wait until 20H1 release and update the example then?

ysc3839 commented 4 years ago

@davidhewitt Sorry, I removed support for insider builds. Because it's difficult to maintain compatibility. It now using SetWindowCompositionAttribute to set dark title bar, which should work on newer insiders.