marlersoft / zigwin32

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

wide-char window classes are wrong #24

Open Inve1951 opened 7 months ago

Inve1951 commented 7 months ago

e.g. https://github.com/marlersoft/zigwin32/blob/6777f1db221d0cb50322842f558f03e3c3a4099f/win32/ui/controls.zig#L1881-L1886 should be something like

pub const WC_STATICA = "Static";
pub const WC_STATICW = @import("../zig.zig").L(WC_STATICA);
pub const WC_EDITA = "Edit";
pub const WC_EDITW = @import("../zig.zig").L(WC_EDITA);

pub usingnamespace switch(@import("../zig.zig").unicode_mode) {
    .ansi => struct {
        pub const WC_STATIC = WC_STATICA;
        pub const WC_EDIT = WC_EDITA;
    },
    .wide => struct {
        pub const WC_STATIC = WC_STATICW;
        pub const WC_EDIT = WC_EDITW;
    },
    .unspecified => struct {
        pub const WC_STATIC = @compileError("'WC_STATIC' requires that UNICODE be set to true or false in the root module");
        pub const WC_EDIT = @compileError("'WC_EDIT' requires that UNICODE be set to true or false in the root module");
    },
};
riverar commented 5 months ago

Heads up for @marler8997, encoding for strings in metadata is utf16 unless otherwise annotated

public const string WC_STATICW = "Static";

[NativeEncoding("ansi")]
public const string WC_STATICA = "Static";