diff --git a/glfw/cocoa_displaylink.m b/glfw/cocoa_displaylink.m index 3f2a1a44b..47c0b3011 100644 --- a/glfw/cocoa_displaylink.m +++ b/glfw/cocoa_displaylink.m @@ -84,11 +84,9 @@ CGDirectDisplayID displayID = entry->displayID; if (should_dispatch) entry->pending_dispatch = true; os_unfair_lock_unlock(lock); - if (should_dispatch) { - NSNumber *arg = [NSNumber numberWithUnsignedInt:displayID]; - [NSApp performSelectorOnMainThread:@selector(render_frame_received:) withObject:arg waitUntilDone:NO]; - [arg release]; - } + if (should_dispatch) dispatch_async(dispatch_get_main_queue(), ^{ + _glfwDispatchRenderFrame(displayID); + }); } return kCVReturnSuccess; } diff --git a/glfw/cocoa_init.m b/glfw/cocoa_init.m index b03c770b9..296949eed 100644 --- a/glfw/cocoa_init.m +++ b/glfw/cocoa_init.m @@ -500,7 +500,6 @@ - (void)applicationDidHide:(NSNotification *)notification @interface GLFWApplication : NSApplication - (void)tick_callback; -- (void)render_frame_received:(id)displayIDAsID; @end @implementation GLFWApplication @@ -509,12 +508,6 @@ - (void)tick_callback _glfwDispatchTickCallback(); } -- (void)render_frame_received:(id)displayIDAsID -{ - CGDirectDisplayID displayID = [(NSNumber*)displayIDAsID unsignedIntValue]; - _glfwDispatchRenderFrame(displayID); -} - @end