mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-16 05:27:43 +00:00
Got explicit about threading guarantees.
This commit is contained in:
@@ -12,14 +12,46 @@
|
|||||||
@class CSOpenGLView;
|
@class CSOpenGLView;
|
||||||
|
|
||||||
@protocol CSOpenGLViewDelegate
|
@protocol CSOpenGLViewDelegate
|
||||||
|
/*!
|
||||||
|
Tells the delegate that time has advanced. This method will always be called on the same queue
|
||||||
|
as the @c CSOpenGLViewResponderDelegate methods.
|
||||||
|
@param view The view sending the message.
|
||||||
|
@param time The time to which time has advanced.
|
||||||
|
*/
|
||||||
- (void)openGLView:(nonnull CSOpenGLView *)view didUpdateToTime:(CVTimeStamp)time;
|
- (void)openGLView:(nonnull CSOpenGLView *)view didUpdateToTime:(CVTimeStamp)time;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Requests that the delegate produce an image of its current output state. May be called on
|
||||||
|
any queue or thread.
|
||||||
|
@param view The view makin the request.
|
||||||
|
@param onlyIfDirty If @c YES then the delegate may decline to redraw if its output would be
|
||||||
|
identical to the previous frame. If @c NO then the delegate must draw.
|
||||||
|
*/
|
||||||
- (void)openGLView:(nonnull CSOpenGLView *)view drawViewOnlyIfDirty:(BOOL)onlyIfDirty;
|
- (void)openGLView:(nonnull CSOpenGLView *)view drawViewOnlyIfDirty:(BOOL)onlyIfDirty;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@protocol CSOpenGLViewResponderDelegate <NSObject>
|
@protocol CSOpenGLViewResponderDelegate <NSObject>
|
||||||
|
/*!
|
||||||
|
Supplies a keyDown event to the delegate. Will always be called on the same queue as the other
|
||||||
|
@c CSOpenGLViewResponderDelegate methods and as -[CSOpenGLViewDelegate openGLView:didUpdateToTime:].
|
||||||
|
@param event The @c NSEvent describing the keyDown.
|
||||||
|
*/
|
||||||
- (void)keyDown:(nonnull NSEvent *)event;
|
- (void)keyDown:(nonnull NSEvent *)event;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Supplies a keyUp event to the delegate. Will always be called on the same queue as the other
|
||||||
|
@c CSOpenGLViewResponderDelegate methods and as -[CSOpenGLViewDelegate openGLView:didUpdateToTime:].
|
||||||
|
@param event The @c NSEvent describing the keyUp.
|
||||||
|
*/
|
||||||
- (void)keyUp:(nonnull NSEvent *)event;
|
- (void)keyUp:(nonnull NSEvent *)event;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Supplies a flagsChanged event to the delegate. Will always be called on the same queue as the other
|
||||||
|
@c CSOpenGLViewResponderDelegate methods and as -[CSOpenGLViewDelegate openGLView:didUpdateToTime:].
|
||||||
|
@param event The @c NSEvent describing the flagsChanged.
|
||||||
|
*/
|
||||||
- (void)flagsChanged:(nonnull NSEvent *)newModifiers;
|
- (void)flagsChanged:(nonnull NSEvent *)newModifiers;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -31,8 +63,13 @@
|
|||||||
@property (nonatomic, weak) id <CSOpenGLViewDelegate> delegate;
|
@property (nonatomic, weak) id <CSOpenGLViewDelegate> delegate;
|
||||||
@property (nonatomic, weak) id <CSOpenGLViewResponderDelegate> responderDelegate;
|
@property (nonatomic, weak) id <CSOpenGLViewResponderDelegate> responderDelegate;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Ends the timer tracking time; should be called prior to giving up the last owning reference
|
||||||
|
to ensure that any retain cycles implied by the timer are resolved.
|
||||||
|
*/
|
||||||
- (void)invalidate;
|
- (void)invalidate;
|
||||||
|
|
||||||
|
/// The size in pixels of the OpenGL canvas, factoring in screen pixel density and view size in points.
|
||||||
@property (nonatomic, readonly) CGSize backingSize;
|
@property (nonatomic, readonly) CGSize backingSize;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -137,9 +137,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
|||||||
|
|
||||||
- (void)drawRect:(NSRect)dirtyRect
|
- (void)drawRect:(NSRect)dirtyRect
|
||||||
{
|
{
|
||||||
dispatch_sync(_dispatchQueue, ^{
|
[self drawViewOnlyIfDirty:NO];
|
||||||
[self drawViewOnlyIfDirty:NO];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawViewOnlyIfDirty:(BOOL)onlyIfDirty
|
- (void)drawViewOnlyIfDirty:(BOOL)onlyIfDirty
|
||||||
|
Reference in New Issue
Block a user