changeset 1478:7216f4301364

Fix mixing frame and content sizes on the Mac.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 22 Dec 2011 09:53:02 +0000
parents 9097a5eb144c
children 1d414e81a099
files mac/dw.m
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Wed Dec 21 13:21:39 2011 +0000
+++ b/mac/dw.m	Thu Dec 22 09:53:02 2011 +0000
@@ -8443,8 +8443,11 @@
     {
         NSWindow *window = handle;
         Box *thisbox;
-        NSSize size;
+        NSRect content, frame = NSMakeRect(0, 0, width, height);
        
+        /* Convert the external frame size to internal content size */
+        content = [NSWindow contentRectForFrameRect:frame styleMask:[window styleMask]];
+        
         /*
          * The following is an attempt to dynamically size a window based on the size of its
          * children before realization. Only applicable when width or height is less than one.
@@ -8457,14 +8460,12 @@
             _resize_box(thisbox, &depth, (int)width, (int)height, 1);
           
             /* Might need to take into account the window border here */
-            if(width < 1) width = thisbox->minwidth;
-            if(height < 1) height = thisbox->minheight;
+            if(width < 1) content.size.width = thisbox->minwidth;
+            if(height < 1) content.size.height = thisbox->minheight;
         }
        
         /* Finally set the size */
-        size.width = width;
-        size.height = height;
-        [window setContentSize:size];
+        [window setContentSize:content.size];
     }
     DW_MUTEX_UNLOCK;
 }