1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-04 18:29:40 +00:00

Corrects Mac paste pathway.

Also updates documentation around CSOpenGLView.
This commit is contained in:
Thomas Harte 2018-05-13 11:12:03 -04:00
parent 8b23a08fc4
commit 3747d96b22
3 changed files with 20 additions and 9 deletions

View File

@ -167,7 +167,7 @@ class MachineDocument:
}
// MARK: the pasteboard
func paste(_ sender: AnyObject!) {
func paste(_ sender: Any) {
let pasteboard = NSPasteboard.general
if let string = pasteboard.string(forType: .string) {
self.machine.paste(string)

View File

@ -32,31 +32,33 @@
@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:].
Supplies a keyDown event to the delegate.
@param event The @c NSEvent describing the keyDown.
*/
- (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:].
Supplies a keyUp event to the delegate.
@param event The @c NSEvent describing the keyUp.
*/
- (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:].
Supplies a flagsChanged event to the delegate.
@param event The @c NSEvent describing the flagsChanged.
*/
- (void)flagsChanged:(nonnull NSEvent *)event;
/*!
Supplies a paste event to the delegate.
*/
- (void)paste:(nonnull id)sender;
@end
/*!
Provides an OpenGL canvas with a refresh-linked update timer and manages a serial dispatch queue
such that a delegate may produce video and respond to keyboard events.
Provides an OpenGL canvas with a refresh-linked update timer that can forward a subset
of typical first-responder actions.
*/
@interface CSOpenGLView : NSOpenGLView
@ -72,6 +74,10 @@
/// The size in pixels of the OpenGL canvas, factoring in screen pixel density and view size in points.
@property (nonatomic, readonly) CGSize backingSize;
/*!
Locks this view's OpenGL context and makes it current, performs @c action and then unlocks
the context. @c action is performed on the calling queue.
*/
- (void)performWithGLContext:(nonnull dispatch_block_t)action;
@end

View File

@ -162,6 +162,11 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
[self.responderDelegate flagsChanged:theEvent];
}
- (void)paste:(id)sender
{
[self.responderDelegate paste:sender];
}
#pragma mark - NSDraggingDestination
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender