From d751fea5105a1a932e58bef59525f14dda45b3c5 Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Fri, 9 Aug 2013 09:12:07 -0400 Subject: [PATCH] Fixed: constraining window's to the screen did not respect a window's minSize. Previously, when the platform window was resized, windows were moved/resized to stay within the virtual screen, but if the window had a minimum size, it was not respected. This commit ensures that if a window has a minimum size, it will always be respected. --- AppKit/CPWindow/CPWindow.j | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index 6bab89979..c7940d141 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -763,7 +763,7 @@ CPTexturedBackgroundWindowMask if (CGRectGetWidth(frame) > usableWidth) { frame.origin.x = CGRectGetMinX(usableRect); - frame.size.width = usableWidth; + frame.size.width = MAX(usableWidth, _minSize.width); } } @@ -782,7 +782,7 @@ CPTexturedBackgroundWindowMask if (CGRectGetHeight(frame) > usableHeight) { frame.origin.y = CGRectGetMinY(usableRect); - frame.size.height = usableHeight; + frame.size.height = MAX(usableHeight, _minSize.height); } } @@ -792,7 +792,7 @@ CPTexturedBackgroundWindowMask /* Constrain the origin of a frame such that: - - CPWindowMinVisibleHorizontalMargin is kept onscreen at the left/right of the window. + - The window view's minimum resize width is kept onscreen at the left/right of the window. - The top of the window is kept below the top of the usable content. - The top of the contentView + CPWindowMinVisibleVerticalMargin is kept above the bottom of the usable content. */