From 0d31f79f53b518ed2ded9c6038bca0ab9f5843d3 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Fri, 4 Jan 2013 11:13:18 +0000 Subject: [PATCH] Constrain window resize to usable area of platform window. --- AppKit/CPWindow/_CPWindowView.j | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j index 2661ec0701..9ad1f4f876 100644 --- a/AppKit/CPWindow/_CPWindowView.j +++ b/AppKit/CPWindow/_CPWindowView.j @@ -390,6 +390,7 @@ var _CPWindowViewResizeIndicatorImage = nil, newY = _CGRectGetMinY(_resizeFrame), newWidth = _CGRectGetWidth(_resizeFrame), newHeight = _CGRectGetHeight(_resizeFrame), + platformFrame = [[theWindow platformWindow] usableContentFrame], minSize = [theWindow minSize], maxSize = [theWindow maxSize]; @@ -440,7 +441,10 @@ var _CPWindowViewResizeIndicatorImage = nil, if (theWindow._isSheet && theWindow._parentView && (frame.size.width !== newWidth)) [theWindow._parentView _setAttachedSheetFrameOrigin]; - [theWindow setFrame:_CGRectMake(newX, newY, newWidth, newHeight)]; + // Constrain resize to fit within the platform window. + var newFrame = CGRectIntersection(_CGRectMake(newX, newY, newWidth, newHeight), platformFrame); + + [theWindow setFrame:newFrame]; [self setCursorForLocation:location resizing:YES]; }