racket/gui cocoa: fix swapping of buttons with the 'border style

Register a button as a default button every time that it is shown,
so that multiple buttons in a frame can have the 'border style
(as long as only one is shown at a time).

original commit: a9cc79c89b438cf8eda9b66541f1cfaf6b3c1e4c
This commit is contained in:
Matthew Flatt 2013-04-20 08:50:12 -06:00
parent 41201422ee
commit 59fc6cc987

View File

@ -150,8 +150,10 @@
[no-show? (memq 'deleted style)]
[callback cb])
(when (memq 'border style)
(tellv (get-cocoa-window) setDefaultButtonCell: (tell button-cocoa cell)))
(define default-button? (memq 'border style))
(define/override (show-children)
(when default-button?
(tellv (get-cocoa-window) setDefaultButtonCell: (tell button-cocoa cell))))
(tellv button-cocoa setTarget: button-cocoa)
(tellv button-cocoa setAction: #:type _SEL (selector clicked:))