diff --git a/OSBindings/Mac/Clock Signal/Views/CSOpenGLView.m b/OSBindings/Mac/Clock Signal/Views/CSOpenGLView.m index eb783f3a1..3538ff655 100644 --- a/OSBindings/Mac/Clock Signal/Views/CSOpenGLView.m +++ b/OSBindings/Mac/Clock Signal/Views/CSOpenGLView.m @@ -22,6 +22,8 @@ NSTrackingArea *_mouseTrackingArea; NSTimer *_mouseHideTimer; BOOL _mouseIsCaptured; + + id _displayLinkDelegate; } - (void)prepareOpenGL { @@ -70,6 +72,23 @@ CVDisplayLinkStart(_displayLink); } +- (void)setDisplayLinkDelegate:(id)displayLinkDelegate { + @synchronized(self) { + _displayLinkDelegate = displayLinkDelegate; + + // Seed with the current _displayLink, if any. + if(_displayLink) { + [displayLinkDelegate openGLView:self didUpdateDisplayLink:_displayLink]; + } + } +} + +- (id)displayLinkDelegate { + @synchronized(self) { + return _displayLinkDelegate; + } +} + static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *now, const CVTimeStamp *outputTime, CVOptionFlags flagsIn, CVOptionFlags *flagsOut, void *displayLinkContext) { CSOpenGLView *const view = (__bridge CSOpenGLView *)displayLinkContext;