diff options
Diffstat (limited to 'src/Window.zig')
-rw-r--r-- | src/Window.zig | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Window.zig b/src/Window.zig index d5bb8e7..6771e21 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -44,13 +44,13 @@ fn fnCast(comptime DestType: type, comptime fun: anytype) DestType { c.GLFWcursorposfun => struct { pub fn callback(window: ?*Impl, xpos: f64, ypos: f64) callconv(.C) void { - fun(@fieldParentPtr(Self, "pimpl", &window.?).*, xpos, ypos); + fun(@as(*const Self, @fieldParentPtr("pimpl", &window.?)).*, xpos, ypos); } }, c.GLFWkeyfun => struct { pub fn callback(window: ?*Impl, key: c_int, scancode: c_int, action: c_int, mods: c_int) callconv(.C) void { - fun(@fieldParentPtr(Self, "pimpl", &window.?).*, + fun(@as(*const Self, @fieldParentPtr("pimpl", &window.?)).*, @enumFromInt(key), scancode, @enumFromInt(action), Mods.fromInt(mods)); } @@ -58,7 +58,7 @@ fn fnCast(comptime DestType: type, comptime fun: anytype) DestType { c.GLFWmousebuttonfun => struct { pub fn callback(window: ?*Impl, button: c_int, action: c_int, mods: c_int) callconv(.C) void { - fun(@fieldParentPtr(Self, "pimpl", &window.?).*, + fun(@as(*const Self, @fieldParentPtr("pimpl", &window.?)).*, @enumFromInt(button), @enumFromInt(action), Mods.fromInt(mods)); } @@ -66,7 +66,8 @@ fn fnCast(comptime DestType: type, comptime fun: anytype) DestType { c.GLFWwindowsizefun => struct { pub fn callback(window: ?*Impl, width: c_int, height: c_int) callconv(.C) void { - fun(@fieldParentPtr(Self, "pimpl", &window.?).*, width, height); + fun(@as(*const Self, @fieldParentPtr("pimpl", &window.?)).*, + width, height); } }, else => unreachable, |