marlersoft / zigwin32

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

Writing a windowing library #20

Closed eddineimad0 closed 9 months ago

eddineimad0 commented 1 year ago

Hi i wrote a windowing library in zig and i ran into some problems while using zigwin32.

first one was simply resolved by adding a WM_MOUSELEAVE constant.

the second one happend while enumerating all possible Display modes for a display using the EnumDisplaySettignsExW, according to MSDN EnumDisplaySettingsExW : "To obtain information for all of a display device's graphics modes, make a series of calls to EnumDisplaySettingsEx, as follows: Set iModeNum to zero for the first call, and increment iModeNum by one for each subsequent call. Continue calling the function until the return value is zero.", however since iModeNum parameter's type in zigwin32 is enum(u32) with only 2 possible values the code panics in debug build.

rohlem commented 9 months ago

A non-exhaustive enum might fit the use case of ENUM_DISPLAY_SETTINGS_MODE better: That way the type safety remains and the two constants can be accessed as previously, but differing values can be created via @enumFromInt.