Enable Cocoa multi-threaded mode

This commit is contained in:
Camilla Berglund 2016-03-31 21:10:12 +02:00
parent bc649e1632
commit cd49efa84e

View File

@ -763,6 +763,12 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
[super sendEvent:event];
}
// No-op thread entry point
//
- (void)doNothing:(id)object
{
}
@end
#if defined(_GLFW_USE_MENUBAR)
@ -888,6 +894,11 @@ static GLFWbool initializeAppKit(void)
// Implicitly create shared NSApplication instance
[GLFWApplication sharedApplication];
// Make Cocoa enter multi-threaded mode
[NSThread detachNewThreadSelector:@selector(doNothing:)
toTarget:NSApp
withObject:nil];
// In case we are unbundled, make us a proper UI application
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];