Moved window delegate creation to createWindow.

This commit is contained in:
Camilla Berglund 2014-04-06 13:46:16 +02:00
parent b126939b5d
commit 4a8f6ba58c

View File

@ -918,6 +918,14 @@ static GLboolean initializeAppKit(void)
static GLboolean createWindow(_GLFWwindow* window, static GLboolean createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig) 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; unsigned int styleMask = 0;
if (wndconfig->monitor || !wndconfig->decorated) if (wndconfig->monitor || !wndconfig->decorated)
@ -999,14 +1007,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
[NSApp setDelegate:_glfw.ns.delegate]; [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)) if (!createWindow(window, wndconfig))
return GL_FALSE; return GL_FALSE;