From 345fea09a6d5638f5aacb5bebc1904189bcd9b18 Mon Sep 17 00:00:00 2001 From: terraquad Date: Wed, 20 Nov 2024 18:44:33 +0100 Subject: [PATCH 1/2] Rename `Hint` to `InitHint` for clarity (#5) --- src/zglfw.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/zglfw.zig b/src/zglfw.zig index d1a456b..f98b433 100644 --- a/src/zglfw.zig +++ b/src/zglfw.zig @@ -13,7 +13,7 @@ comptime { // Misc // //-------------------------------------------------------------------------------------------------- -pub const Hint = enum(i32) { +pub const InitHint = enum(i32) { joystick_hat_buttons = 0x00050001, angle_platform_type = 0x00050002, platform = 0x00050003, @@ -22,10 +22,10 @@ pub const Hint = enum(i32) { x11_xcb_vulkan_surface = 0x00052001, wayland_libdecor = 0x00053001, - pub fn set(hint: Hint, value: bool) void { + pub fn set(hint: InitHint, value: bool) void { glfwInitHint(hint, @intFromBool(value)); } - extern fn glfwInitHint(hint: Hint, value: i32) void; + extern fn glfwInitHint(hint: InitHint, value: i32) void; }; pub fn init() Error!void { From ce756faacf52c7531bc09bdc0201004596c0a01f Mon Sep 17 00:00:00 2001 From: Chris Heyes <22148308+hazeycode@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:28:11 +0000 Subject: [PATCH 2/2] Current context can be NULL Fixes #6 --- src/zglfw.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zglfw.zig b/src/zglfw.zig index f98b433..5bf589a 100644 --- a/src/zglfw.zig +++ b/src/zglfw.zig @@ -147,10 +147,10 @@ pub fn rawMouseMotionSupported() bool { extern fn glfwRawMouseMotionSupported() i32; pub const makeContextCurrent = glfwMakeContextCurrent; -extern fn glfwMakeContextCurrent(window: *Window) void; +extern fn glfwMakeContextCurrent(window: ?*Window) void; pub const getCurrentContext = glfwGetCurrentContext; -extern fn glfwGetCurrentContext() *Window; +extern fn glfwGetCurrentContext() ?*Window; pub const swapInterval = glfwSwapInterval; extern fn glfwSwapInterval(interval: i32) void;