Skip to content
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

Newer DWMWINDOWATTRIBUTE / DWMA_ values are missing #252

Closed
rickbrew opened this issue Nov 17, 2021 · 12 comments
Closed

Newer DWMWINDOWATTRIBUTE / DWMA_ values are missing #252

rickbrew opened this issue Nov 17, 2021 · 12 comments
Labels
bug An issue for something that does not behave as expected. untriaged An issue that has not been triaged by the repo maintainers.

Comments

@rickbrew
Copy link
Contributor

Looks like DWMWA_USE_IMMERSIVE_DARK_MODE and a few others are now in the headers and listed in the docs page https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute, although they lack descriptions

typedef enum DWMWINDOWATTRIBUTE {
  DWMWA_NCRENDERING_ENABLED,
  DWMWA_NCRENDERING_POLICY,
  DWMWA_TRANSITIONS_FORCEDISABLED,
  DWMWA_ALLOW_NCPAINT,
  DWMWA_CAPTION_BUTTON_BOUNDS,
  DWMWA_NONCLIENT_RTL_LAYOUT,
  DWMWA_FORCE_ICONIC_REPRESENTATION,
  DWMWA_FLIP3D_POLICY,
  DWMWA_EXTENDED_FRAME_BOUNDS,
  DWMWA_HAS_ICONIC_BITMAP,
  DWMWA_DISALLOW_PEEK,
  DWMWA_EXCLUDED_FROM_PEEK,
  DWMWA_CLOAK,
  DWMWA_CLOAKED,
  DWMWA_FREEZE_REPRESENTATION,
  DWMWA_PASSIVE_UPDATE_MODE,
  DWMWA_USE_HOSTBACKDROPBRUSH,
  DWMWA_USE_IMMERSIVE_DARK_MODE,
  DWMWA_WINDOW_CORNER_PREFERENCE,
  DWMWA_BORDER_COLOR,
  DWMWA_CAPTION_COLOR,
  DWMWA_TEXT_COLOR,
  DWMWA_VISIBLE_FRAME_BORDER_THICKNESS,
  DWMWA_LAST
} ;
@rickbrew rickbrew added bug An issue for something that does not behave as expected. untriaged An issue that has not been triaged by the repo maintainers. labels Nov 17, 2021
@AraHaan
Copy link

AraHaan commented Nov 18, 2021

It has 2 values, it's first value was 19 then a later build changed it to 20.

So that value will have to be an property so it can do a Windows versions check to return either 19 or 20.

Just for simplicity the version where it changed is:

OperatingSystem.IsWindowsVersionAtLeast(10, 0, 18985) ? /* DWMWA_USE_IMMERSIVE_DARK_MODE is 20 */ : /* DWMWA_USE_IMMERSIVE_DARK_MODE is 19 */;

@rickbrew
Copy link
Contributor Author

Yeah I've seen the "old" version of the constant named something like DWMMA_USE_IMMSERVE_DARK_MODE_BEFORE_20H1 e.g. https://stackoverflow.com/questions/57124243/winforms-dark-title-bar-on-windows-10

@AraHaan
Copy link

AraHaan commented Nov 18, 2021

https://github.com/terrafx/terrafx.interop.windows/blob/main/sources/Interop/Windows/Windows/um/dwmapi/DWMWINDOWATTRIBUTE.cs I see it here now for some reason though but it is set to 20. In this case (like you said) we also need the 19 one which is DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1.

The only think I can think of is making that type a static class with all the constants being properties or something as idk if that file is auto generated or not.

@AraHaan
Copy link

AraHaan commented Nov 18, 2021

I took the liberty to document it myself: https://github.com/MicrosoftDocs/sdk-api/pull/966/files/

@tannergooding
Copy link
Member

@rickbrew, could you please clarify which enum values you are seeing as missing: https://source.terrafx.dev/#TerraFX.Interop.Windows/Windows/um/dwmapi/DWMWINDOWATTRIBUTE.cs,13dae90f41e4a48c?

The older value (BEFORE_20H1) is undocumented and has never shipped in any version of the Windows SDK. It will not be defined, nor will the undocumented enum value for 18.

If users want or need to rely on undocumented values/behaviors, they'll need to define their own constants to represent it.

@rickbrew
Copy link
Contributor Author

The undocumented one shouldn't be included, I agree

These are missing:

DWMWA_WINDOW_CORNER_PREFERENCE,
DWMWA_BORDER_COLOR,
DWMWA_CAPTION_COLOR,
DWMWA_TEXT_COLOR,
DWMWA_VISIBLE_FRAME_BORDER_THICKNESS,
DWMWA_LAST (which would be a higher value now)

Since these values are documented at https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute , and in the header, they should be included

@AraHaan
Copy link

AraHaan commented Nov 18, 2021

Perhaps it will be included when TerraFX updates the Windows SDK perhaps?

@AraHaan
Copy link

AraHaan commented Nov 18, 2021

@rickbrew, could you please clarify which enum values you are seeing as missing: https://source.terrafx.dev/#TerraFX.Interop.Windows/Windows/um/dwmapi/DWMWINDOWATTRIBUTE.cs,13dae90f41e4a48c?

The older value (BEFORE_20H1) is undocumented and has never shipped in any version of the Windows SDK. It will not be defined, nor will the undocumented enum value for 18.

If users want or need to rely on undocumented values/behaviors, they'll need to define their own constants to represent it.

True, but I technically did document it in a PR to sdk-api indirectly by documenting the one that is provided in the Windows SDK. 😄

@rickbrew
Copy link
Contributor Author

rickbrew commented Nov 18, 2021

True, but I technically did document it in a PR to sdk-api indirectly by documenting the one that is provided in the Windows SDK. 😄

Only if they accept your PR that documents it. I'm only asking for the ones that are documented to be included in TerraFX.Interop.Windows.

@tannergooding
Copy link
Member

tannergooding commented Nov 18, 2021

@rickbrew, its worth calling out that TerraFX.Interop.Windows currently exposes 10.0.20348.0 which is exactly:

enum DWMWINDOWATTRIBUTE
{
    DWMWA_NCRENDERING_ENABLED = 1,     
    DWMWA_NCRENDERING_POLICY,          
    DWMWA_TRANSITIONS_FORCEDISABLED,   
    DWMWA_ALLOW_NCPAINT,               
    DWMWA_CAPTION_BUTTON_BOUNDS,       
    DWMWA_NONCLIENT_RTL_LAYOUT,        
    DWMWA_FORCE_ICONIC_REPRESENTATION, 
    DWMWA_FLIP3D_POLICY,               
    DWMWA_EXTENDED_FRAME_BOUNDS,       
    DWMWA_HAS_ICONIC_BITMAP,           
    DWMWA_DISALLOW_PEEK,               
    DWMWA_EXCLUDED_FROM_PEEK,          
    DWMWA_CLOAK,                       
    DWMWA_CLOAKED,                     
    DWMWA_FREEZE_REPRESENTATION,       
    DWMWA_PASSIVE_UPDATE_MODE,         
    DWMWA_USE_HOSTBACKDROPBRUSH,       
    DWMWA_USE_IMMERSIVE_DARK_MODE = 20,
    DWMWA_LAST
};

Windows 10.0.22000.0 (i.e. Win 11) adds the additional values you called out:

     DWMWA_USE_IMMERSIVE_DARK_MODE = 20,  
+    DWMWA_WINDOW_CORNER_PREFERENCE = 33, 
+    DWMWA_BORDER_COLOR,                  
+    DWMWA_CAPTION_COLOR,                 
+    DWMWA_TEXT_COLOR,                    
+    DWMWA_VISIBLE_FRAME_BORDER_THICKNESS,
     DWMWA_LAST

@AraHaan
Copy link

AraHaan commented Nov 19, 2021

Also note that my docs was merged 8 hours ago 🎉.

@tannergooding
Copy link
Member

This was resolved when I moved forward to 10.0.22000.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue for something that does not behave as expected. untriaged An issue that has not been triaged by the repo maintainers.
Projects
None yet
Development

No branches or pull requests

3 participants