Explorar o código

Cocoa: Fix 'first responder' error on macOS 10.12

Error message is displayed during the startup because Cocoa view is set
as the first responder for window but this view isn't in this window
(actually it is not in any window at all).

Fixes #876.
Closes #883.
Sergey Tikhomirov %!s(int64=9) %!d(string=hai) anos
pai
achega
967e837c73
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/cocoa_window.m

+ 1 - 1
src/cocoa_window.m

@@ -1032,11 +1032,11 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
     [window->ns.view setWantsBestResolutionOpenGLSurface:YES];
     [window->ns.view setWantsBestResolutionOpenGLSurface:YES];
 #endif /*_GLFW_USE_RETINA*/
 #endif /*_GLFW_USE_RETINA*/
 
 
+    [window->ns.object setContentView:window->ns.view];
     [window->ns.object makeFirstResponder:window->ns.view];
     [window->ns.object makeFirstResponder:window->ns.view];
     [window->ns.object setTitle:[NSString stringWithUTF8String:wndconfig->title]];
     [window->ns.object setTitle:[NSString stringWithUTF8String:wndconfig->title]];
     [window->ns.object setDelegate:window->ns.delegate];
     [window->ns.object setDelegate:window->ns.delegate];
     [window->ns.object setAcceptsMouseMovedEvents:YES];
     [window->ns.object setAcceptsMouseMovedEvents:YES];
-    [window->ns.object setContentView:window->ns.view];
     [window->ns.object setRestorable:NO];
     [window->ns.object setRestorable:NO];
 
 
     return GLFW_TRUE;
     return GLFW_TRUE;