racket/gui cocoa: toolbar-button is for 10.6 and earlier, only

In particular, 'toobar-button (before 10.7) and 'fullscreen-button
(10.7 and later) do not get along, so use only one of them.
This commit is contained in:
Matthew Flatt 2014-04-05 16:25:25 -06:00
parent 32374df556
commit 5193e37f0b
2 changed files with 11 additions and 9 deletions

View File

@ -70,8 +70,9 @@ some platforms:
(Windows)} (Windows)}
@item{@racket['toolbar-button] --- includes a toolbar button on the @item{@racket['toolbar-button] --- includes a toolbar button on the
frame's title bar (Mac OS X); a click on the toolbar button triggers frame's title bar (Mac OS X 10.6 and earlier); a click on the toolbar button triggers
a call to @method[frame% on-toolbar-button-click]} a call to @method[frame% on-toolbar-button-click]}
@item{@racket['hide-menu-bar] --- hides the menu bar and dock when @item{@racket['hide-menu-bar] --- hides the menu bar and dock when
the frame is active (Mac OS X) or asks the window manager to make the frame is active (Mac OS X) or asks the window manager to make
the frame fullscreen (Unix)} the frame fullscreen (Unix)}
@ -87,10 +88,10 @@ some platforms:
@item{@racket['metal] --- ignored (formerly supported for Mac OS X)} @item{@racket['metal] --- ignored (formerly supported for Mac OS X)}
@item{@racket['fullscreen-button] --- includes a button on the @item{@racket['fullscreen-button] --- includes a button on the
frame's title bar to put the frame in fullscreen mode (Mac OS X)} frame's title bar to put the frame in fullscreen mode (Mac OS X 10.7 and later)}
@item{@racket['fullscreen-aux] --- allows the frame to accompany @item{@racket['fullscreen-aux] --- allows the frame to accompany
another that is in fullscreen mode (Mac OS X)} another that is in fullscreen mode (Mac OS X 10.7 and later)}
] ]

View File

@ -266,12 +266,13 @@
(define cocoa (get-cocoa)) (define cocoa (get-cocoa))
(tellv cocoa setDelegate: cocoa) (tellv cocoa setDelegate: cocoa)
(unless (version-10.7-or-later?)
(when (memq 'toolbar-button style) (when (memq 'toolbar-button style)
(atomically (atomically
(let ([tb (tell (tell NSToolbar alloc) initWithIdentifier: #:type _NSString "Ok")]) (let ([tb (tell (tell NSToolbar alloc) initWithIdentifier: #:type _NSString "Ok")])
(tellv cocoa setToolbar: tb) (tellv cocoa setToolbar: tb)
(tellv tb setVisible: #:type _BOOL #f) (tellv tb setVisible: #:type _BOOL #f)
(tellv tb release)))) (tellv tb release)))))
(internal-move #f (or y 0)) (internal-move #f (or y 0))