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
This commit is contained in:
Matthew Flatt 2013-04-19 06:00:05 -06:00
parent fff7d03713
commit 475b2cd1a7
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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)]