diff --git a/src/cocoa_window.m b/src/cocoa_window.m index cbf74ecd..53520b29 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -918,6 +918,14 @@ static GLboolean initializeAppKit(void) static GLboolean createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig) { + window->ns.delegate = [[GLFWWindowDelegate alloc] initWithGlfwWindow:window]; + if (window->ns.delegate == nil) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Cocoa: Failed to create window delegate"); + return GL_FALSE; + } + unsigned int styleMask = 0; if (wndconfig->monitor || !wndconfig->decorated) @@ -999,14 +1007,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, [NSApp setDelegate:_glfw.ns.delegate]; } - window->ns.delegate = [[GLFWWindowDelegate alloc] initWithGlfwWindow:window]; - if (window->ns.delegate == nil) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Cocoa: Failed to create window delegate"); - return GL_FALSE; - } - if (!createWindow(window, wndconfig)) return GL_FALSE;