glfw: add glfw.postEmptyEvent

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2021-10-16 18:25:31 -07:00 committed by Stephen Gutekanst
parent 66678f1df0
commit 5a5078b885

View file

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