cocoa: avoid another 10.6-only method

Closes PR 11440
This commit is contained in:
Matthew Flatt 2010-11-16 17:08:14 -07:00
parent 7b24eaf58e
commit 584287483b
3 changed files with 13 additions and 6 deletions

View File

@ -74,7 +74,9 @@
;; all other eventspaces and threads. It would be nice to improve
;; on this, but it's good enough.
(atomically
(let ([front (get-front)])
(let ([front (get-front)]
[parent (and (version-10.6-or-later?)
parent)])
(when parent
(tellv ns beginSheetModalForWindow: (send parent get-cocoa-window)
completionHandler: #f))

View File

@ -63,7 +63,7 @@
(create-menu "menu")
(let ([b (box #f)])
(set! popup-box b)
(if #t ;; use the 10.5 code, for now
(if (not (version-10.6-or-later?))
;; For 10.5 and earlier:
(let ([p (tell #:type _NSPoint v
convertPoint: #:type _NSPoint (make-NSPoint x y)

View File

@ -21,7 +21,8 @@
clean-menu-label
->wxb
->wx
old-cocoa?)
old-cocoa?
version-10.6-or-later?)
define-mz)
(define cocoa-lib (ffi-lib (format "/System/Library/Frameworks/Cocoa.framework/Cocoa")))
@ -79,6 +80,10 @@
(and wxb
(weak-box-value wxb)))
;; FIXME: need a better test:
(define old-cocoa? (equal? (path->string (system-library-subpath #f))
"ppc-macosx"))
(define-appkit NSAppKitVersionNumber _double)
(define old-cocoa?
; earlier than 10.5?
(NSAppKitVersionNumber . < . 949))
(define (version-10.6-or-later?)
(NSAppKitVersionNumber . >= . 1038))