1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Ensures new displayLinkDelegates get a nudge with the initial display link.

This commit is contained in:
Thomas Harte 2020-02-04 23:08:25 -05:00
parent e7410b8ed8
commit e1cbad0b6d

View File

@ -22,6 +22,8 @@
NSTrackingArea *_mouseTrackingArea;
NSTimer *_mouseHideTimer;
BOOL _mouseIsCaptured;
id<CSOpenGLViewDisplayLinkDelegate> _displayLinkDelegate;
}
- (void)prepareOpenGL {
@ -70,6 +72,23 @@
CVDisplayLinkStart(_displayLink);
}
- (void)setDisplayLinkDelegate:(id<CSOpenGLViewDisplayLinkDelegate>)displayLinkDelegate {
@synchronized(self) {
_displayLinkDelegate = displayLinkDelegate;
// Seed with the current _displayLink, if any.
if(_displayLink) {
[displayLinkDelegate openGLView:self didUpdateDisplayLink:_displayLink];
}
}
}
- (id<CSOpenGLViewDisplayLinkDelegate>)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;