diff --git a/collects/mred/private/wx/cocoa/button.rkt b/collects/mred/private/wx/cocoa/button.rkt index 936af6100f..9757491982 100644 --- a/collects/mred/private/wx/cocoa/button.rkt +++ b/collects/mred/private/wx/cocoa/button.rkt @@ -22,6 +22,7 @@ (import-class NSButton NSView NSImageView) (define MIN-BUTTON-WIDTH 72) +(define BUTTON-EXTRA-WIDTH 12) (define-objc-class MyButton NSButton #:mixins (FocusResponder KeyMouseResponder CursorDisplayer) @@ -62,11 +63,12 @@ (when (and (eq? event-type 'button) (string? label)) (let ([frame (tell #:type _NSRect cocoa frame)]) - (when ((NSSize-width (NSRect-size frame)) . < . MIN-BUTTON-WIDTH) - (tellv cocoa setFrame: #:type _NSRect - (make-NSRect (NSRect-origin frame) - (make-NSSize MIN-BUTTON-WIDTH - (NSSize-height (NSRect-size frame)))))))) + (tellv cocoa setFrame: #:type _NSRect + (make-NSRect (NSRect-origin frame) + (make-NSSize (+ BUTTON-EXTRA-WIDTH + (max MIN-BUTTON-WIDTH + (NSSize-width (NSRect-size frame)))) + (NSSize-height (NSRect-size frame))))))) cocoa)) (define cocoa (if (and button-type diff --git a/collects/mred/private/wx/cocoa/window.rkt b/collects/mred/private/wx/cocoa/window.rkt index 269c654503..00debc6607 100644 --- a/collects/mred/private/wx/cocoa/window.rkt +++ b/collects/mred/private/wx/cocoa/window.rkt @@ -484,9 +484,10 @@ (void)) (define/public (set-focus) - (let ([w (tell cocoa window)]) - (when w - (tellv w makeFirstResponder: (get-cocoa-content))))) + (when (gets-focus?) + (let ([w (tell cocoa window)]) + (when w + (tellv w makeFirstResponder: (get-cocoa-content)))))) (define/public (on-set-focus) (void)) (define/public (on-kill-focus) (void))