From 475b2cd1a76e2d197a148f80aa466a43a7bc160a Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 19 Apr 2013 06:00:05 -0600 Subject: [PATCH] ffi/unsafe/obj: add `+A' and `-A' method modes On Cocoa, a view's `drawRect:' method can be called from a heartbeat thread that animates controls. Such a call happens rarely for a `canvas%' or other class where `drawRect:' is overridden, but since it can happen, ensure that the callback runs on the Racket thread. original commit: 57516164de983a9245bfee88cbf87b9ea5c13a25 --- collects/mred/private/wx/cocoa/canvas.rkt | 8 ++++---- collects/mred/private/wx/cocoa/panel.rkt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/collects/mred/private/wx/cocoa/canvas.rkt b/collects/mred/private/wx/cocoa/canvas.rkt index c7c6989b..cbb99ea8 100644 --- a/collects/mred/private/wx/cocoa/canvas.rkt +++ b/collects/mred/private/wx/cocoa/canvas.rkt @@ -65,7 +65,7 @@ (define-objc-mixin (RacketViewMixin Superclass) #:mixins (KeyMouseTextResponder CursorDisplayer FocusResponder) [wxb] - (-a _void (drawRect: [_NSRect r]) + (-A _void (drawRect: [_NSRect r]) (when wxb (let ([wx (->wx wxb)]) (when wx @@ -98,7 +98,7 @@ (define-objc-class CornerlessFrameView NSView [] - (-a _void (drawRect: [_NSRect r]) + (-A _void (drawRect: [_NSRect r]) (let ([ctx (tell NSGraphicsContext currentContext)]) (tellv ctx saveGraphicsState) (let ([cg (tell #:type _CGContextRef ctx graphicsPort)] @@ -129,7 +129,7 @@ [on?] (-a _void (setFocusState: [_BOOL is-on?]) (set! on? is-on?)) - (-a _void (drawRect: [_NSRect r]) + (-A _void (drawRect: [_NSRect r]) (let ([f (tell #:type _NSRect self frame)]) (tellv bezel-cell drawWithFrame: #:type _NSRect (make-NSRect (make-NSPoint 2 2) @@ -154,7 +154,7 @@ #:mixins (FocusResponder KeyMouseTextResponder CursorDisplayer) #:protocols (NSComboBoxDelegate) [wxb] - (-a _void (drawRect: [_NSRect r]) + (-A _void (drawRect: [_NSRect r]) (super-tell #:type _void drawRect: #:type _NSRect r) (let ([wx (->wx wxb)]) (when wx diff --git a/collects/mred/private/wx/cocoa/panel.rkt b/collects/mred/private/wx/cocoa/panel.rkt index c4f1880e..55962b19 100644 --- a/collects/mred/private/wx/cocoa/panel.rkt +++ b/collects/mred/private/wx/cocoa/panel.rkt @@ -22,7 +22,7 @@ (define-objc-class FrameView NSView [] - (-a _void (drawRect: [_NSRect r]) + (-A _void (drawRect: [_NSRect r]) (let ([ctx (tell NSGraphicsContext currentContext)]) (tellv ctx saveGraphicsState) (let ([cg (tell #:type _CGContextRef ctx graphicsPort)]