marlersoft / zigwin32

Zig bindings for Win32 generated by https://github.com/marlersoft/zigwin32gen
MIT License
257 stars 31 forks source link

Wrong binding for DescribePixelFormat #33

Open delinx opened 3 months ago

delinx commented 3 months ago

Hey,

According to MSDN https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-describepixelformat

The iPixelFormat should be int

int DescribePixelFormat(
  HDC                     hdc,
  int                     iPixelFormat,
  UINT                    nBytes,
  LPPIXELFORMATDESCRIPTOR ppfd
);

In this bindings its defined as (line 1278 open_gl.zig)

// TODO: this type is limited to platform 'windows5.0'
pub extern "gdi32" fn DescribePixelFormat(
    hdc: ?HDC,
    iPixelFormat: PFD_PIXEL_TYPE,
    nBytes: u32,
    // TODO: what to do with BytesParamIndex 2?
    ppfd: ?*PIXELFORMATDESCRIPTOR,
) callconv(@import("std").os.windows.WINAPI) i32;

I assume PFD_PIXEL_TYPE should be changed to i32? Tested locally and it works, got really confused since you are meant to use ChoosePixelFormat return value (i32) as that input.

No idea how to modify this in zigwin32gen, can someone who knows take a look please?

Relevant issue: https://github.com/microsoft/win32metadata/issues/1383