mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 16:52:57 +00:00
Add glfwWaitEventsTimeout
This function will put the calling thread to sleep until an event arrives or until the specified timeout has elapsed.
This commit is contained in:
@@ -1214,6 +1214,19 @@ void _glfwPlatformWaitEvents(void)
|
||||
_glfwPlatformPollEvents();
|
||||
}
|
||||
|
||||
void _glfwPlatformWaitEventsTimeout(double timeout)
|
||||
{
|
||||
NSDate* date = [NSDate dateWithTimeIntervalSinceNow:timeout];
|
||||
NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
|
||||
untilDate:date
|
||||
inMode:NSDefaultRunLoopMode
|
||||
dequeue:YES];
|
||||
if (event)
|
||||
[NSApp sendEvent:event];
|
||||
|
||||
_glfwPlatformPollEvents();
|
||||
}
|
||||
|
||||
void _glfwPlatformPostEmptyEvent(void)
|
||||
{
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
Reference in New Issue
Block a user