diff --git a/glfw/src/main.zig b/glfw/src/main.zig index 7f16b99..0df455c 100644 --- a/glfw/src/main.zig +++ b/glfw/src/main.zig @@ -231,18 +231,20 @@ pub inline fn waitEventsTimeout(timeout: f64) Error!void { try getError(); } -// /// Posts an empty event to the event queue. -// /// -// /// This function posts an empty event from the current thread to the event -// /// queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return. -// /// -// /// Possible errors include glfw.Error.NotInitialized and glfw.Error.PlatformError. -// /// -// /// @thread_safety This function may be called from any thread. -// /// -// /// see also: events, glfw.waitEvents, glfw.waitEventsTimeout -// /// -// GLFWAPI void glfwPostEmptyEvent(void); +/// Posts an empty event to the event queue. +/// +/// This function posts an empty event from the current thread to the event queue, causing +/// glfw.waitEvents or glfw.waitEventsTimeout to return. +/// +/// Possible errors include glfw.Error.NotInitialized and glfw.Error.PlatformError. +/// +/// @thread_safety This function may be called from any thread. +/// +/// see also: events, glfw.waitEvents, glfw.waitEventsTimeout +pub inline fn postEmptyEvent() Error!void { + c.glfwPostEmptyEvent(); + try getError(); +} pub fn basicTest() !void { try init(); @@ -288,6 +290,14 @@ test "waitEventsTimeout" { try waitEventsTimeout(0.25); } +test "postEmptyEvent_and_waitEvents" { + try init(); + defer terminate(); + + try postEmptyEvent(); + try waitEvents(); +} + test "basic" { try basicTest(); }