From 5b3a2cb4b43fd329dbfa86122b83cd87ef79a277 Mon Sep 17 00:00:00 2001 From: Scott Bennett Date: Thu, 4 Oct 2018 10:59:27 -0500 Subject: [PATCH] Updated the fix to work on both naked and wrapped (.app) macos executables --- src/cocoa_window.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index c1bd6fd54..cf3f1f3eb 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -266,8 +266,17 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; { self = [super init]; if (self != nil) + { window = initWindow; + // HACK: Force an update shortly after the window appears to avoid the + // issue where macOS mojave does not start rendering to the OpenGL view + dispatch_async(dispatch_get_main_queue(), ^() { + if (window->context.client != GLFW_NO_API) + [window->context.nsgl.object update]; + }); + } + return self; } @@ -343,10 +352,6 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; - (void)windowDidBecomeKey:(NSNotification *)notification { - // Fix for macOS mojave not rendering the OpenGL view on window start - if (window->context.client != GLFW_NO_API) - [window->context.nsgl.object update]; - if (_glfw.ns.disabledCursorWindow == window) centerCursor(window);