From 4995e89a214db7f38a73dba3c29cae0a705a68f4 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 3 Aug 2010 17:13:54 -0600 Subject: [PATCH] finix initial size of cocoa frame original commit: ca29be4eb132bf17dfe552aa78981c1f3115b9c1 --- collects/mred/private/wx/cocoa/frame.rkt | 57 +++++++++++++----------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/collects/mred/private/wx/cocoa/frame.rkt b/collects/mred/private/wx/cocoa/frame.rkt index 31f08de8..d21ed049 100644 --- a/collects/mred/private/wx/cocoa/frame.rkt +++ b/collects/mred/private/wx/cocoa/frame.rkt @@ -101,31 +101,38 @@ (let ([is-sheet? (and #f is-dialog? parent - (not (send parent frame-is-dialog?)))]) - (as-objc-allocation - (tell (tell (if is-sheet? - MyPanel - MyWindow) - alloc) - initWithContentRect: #:type _NSRect (let-values ([(x y) (init-pos x y)]) - (make-NSRect (make-NSPoint x y) - (make-NSSize (max 30 w) - (max 0 h)))) - styleMask: #:type _int (if (memq 'no-caption style) - NSBorderlessWindowMask - (bitwise-ior - NSTitledWindowMask - (if is-sheet? NSUtilityWindowMask 0) - (if is-dialog? - 0 - (bitwise-ior - NSClosableWindowMask - NSMiniaturizableWindowMask - (if (memq 'no-resize-border style) - 0 - NSResizableWindowMask))))) - backing: #:type _int NSBackingStoreBuffered - defer: #:type _BOOL NO)))] + (not (send parent frame-is-dialog?)))] + [init-rect (let-values ([(x y) (init-pos x y)]) + (make-NSRect (make-NSPoint x y) + (make-NSSize (max 30 w) + (max (if (memq 'no-caption style) + 0 + 22) + h))))]) + (let ([c (as-objc-allocation + (tell (tell (if is-sheet? + MyPanel + MyWindow) + alloc) + initWithContentRect: #:type _NSRect init-rect + styleMask: #:type _int (if (memq 'no-caption style) + NSBorderlessWindowMask + (bitwise-ior + NSTitledWindowMask + (if is-sheet? NSUtilityWindowMask 0) + (if is-dialog? + 0 + (bitwise-ior + NSClosableWindowMask + NSMiniaturizableWindowMask + (if (memq 'no-resize-border style) + 0 + NSResizableWindowMask))))) + backing: #:type _int NSBackingStoreBuffered + defer: #:type _BOOL NO))]) + ;; use init rect as frame size, not content size + (tellv c setFrame: #:type _NSRect init-rect display: #:type _BOOL #f) + c))] [no-show? #t]) (define cocoa (get-cocoa)) (tellv cocoa setDelegate: cocoa)