comparison mac/dw.m @ 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 cd3d7e341467
children 4c1c44af201a
comparison
equal deleted inserted replaced
1477:9097a5eb144c 1478:7216f4301364
8441 8441
8442 if([ object isKindOfClass:[ NSWindow class ] ]) 8442 if([ object isKindOfClass:[ NSWindow class ] ])
8443 { 8443 {
8444 NSWindow *window = handle; 8444 NSWindow *window = handle;
8445 Box *thisbox; 8445 Box *thisbox;
8446 NSSize size; 8446 NSRect content, frame = NSMakeRect(0, 0, width, height);
8447 8447
8448 /* Convert the external frame size to internal content size */
8449 content = [NSWindow contentRectForFrameRect:frame styleMask:[window styleMask]];
8450
8448 /* 8451 /*
8449 * The following is an attempt to dynamically size a window based on the size of its 8452 * The following is an attempt to dynamically size a window based on the size of its
8450 * children before realization. Only applicable when width or height is less than one. 8453 * children before realization. Only applicable when width or height is less than one.
8451 */ 8454 */
8452 if((width < 1 || height < 1) && (thisbox = [[window contentView] box])) 8455 if((width < 1 || height < 1) && (thisbox = [[window contentView] box]))
8455 8458
8456 /* Calculate space requirements */ 8459 /* Calculate space requirements */
8457 _resize_box(thisbox, &depth, (int)width, (int)height, 1); 8460 _resize_box(thisbox, &depth, (int)width, (int)height, 1);
8458 8461
8459 /* Might need to take into account the window border here */ 8462 /* Might need to take into account the window border here */
8460 if(width < 1) width = thisbox->minwidth; 8463 if(width < 1) content.size.width = thisbox->minwidth;
8461 if(height < 1) height = thisbox->minheight; 8464 if(height < 1) content.size.height = thisbox->minheight;
8462 } 8465 }
8463 8466
8464 /* Finally set the size */ 8467 /* Finally set the size */
8465 size.width = width; 8468 [window setContentSize:content.size];
8466 size.height = height;
8467 [window setContentSize:size];
8468 } 8469 }
8469 DW_MUTEX_UNLOCK; 8470 DW_MUTEX_UNLOCK;
8470 } 8471 }
8471 8472
8472 /* 8473 /*