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]; [super sendEvent:event];
} }
// No-op thread entry point
//
- (void)doNothing:(id)object
{
}
@end @end
#if defined(_GLFW_USE_MENUBAR) #if defined(_GLFW_USE_MENUBAR)
@ -888,6 +894,11 @@ static GLFWbool initializeAppKit(void)
// Implicitly create shared NSApplication instance // Implicitly create shared NSApplication instance
[GLFWApplication sharedApplication]; [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 // In case we are unbundled, make us a proper UI application
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];