Skip to content

Wrong binding for DescribePixelFormat #33

@delinx

Description

@delinx

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: microsoft/win32metadata#1383

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions