terrafx / terrafx.interop.windows

Interop bindings for Windows.
MIT License
253 stars 31 forks source link

`Windows.DPI_AWARENESS_CONTEXT_*` values are nint instead of `DPI_AWARENESS_CONTEXT` #360

Closed rickbrew closed 9 months ago

rickbrew commented 1 year ago

There's a DPI_AWARENESS_CONTEXT wrapper struct, and the only values you ever want to use are predefined https://learn.microsoft.com/en-us/windows/win32/hidpi/dpi-awareness-context

Those predefined values are over in TerraFX.Interop.Windows.Windows, but they are nuints. This means I have to cast in order to call e.g. SetProcessDpiAwarenessContext

Looks like this needs a manual override

rickbrew commented 1 year ago

Also, since this is essentially an enum (albeit certainly not expressed as such), maybe they could just go inside of DPI_AWARENESS_CONTEXT? 🤔

rickbrew commented 1 year ago

Also worth pointing out is that DPI_AWARENESS_CONTEXT.INVALID, which is cast from -1 just like all the other wrapper structs, is not actually an invalid value -- it is equal to DPI_AWARENESS_CONTEXT_UNAWARE.