From 0dfd3cad43d6ffa1f71a3b44fec8775e1fddce7c Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Thu, 2 Aug 2007 06:35:51 +0000 Subject: [PATCH] Ensure that vertical scrollbars do not cover the resize corner (Cocoa never lets them do it anyway, but there were drawing artifacts, so now there is an explicit check). git-svn-id: http://macvim.googlecode.com/svn/trunk@63 96c4425d-ca35-0410-94e5-3396d5c13a8f --- MMWindowController.m | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/MMWindowController.m b/MMWindowController.m index d12e741ece..2952507c0e 100644 --- a/MMWindowController.m +++ b/MMWindowController.m @@ -832,6 +832,9 @@ NSMutableArray *buildMenuAddress(NSMenu *menu) // HACK! Find the lowest left&right vertical scrollbars, as well as the // leftmost horizontal scrollbar. This hack continues further down. + // + // TODO! Can there be no more than one horizontal scrollbar? If so, the + // code can be simplified. unsigned lowestLeftSbIdx = (unsigned)-1; unsigned lowestRightSbIdx = (unsigned)-1; unsigned leftmostSbIdx = (unsigned)-1; @@ -914,10 +917,18 @@ NSMutableArray *buildMenuAddress(NSMenu *menu) } } + // Vertical scrollers must not cover the resize box in the + // bottom-right corner of the window. + if (rect.origin.y < [NSScroller scrollerWidth]) { + rect.size.height -= [NSScroller scrollerWidth] - rect.origin.y; + rect.origin.y = [NSScroller scrollerWidth]; + } + // Make sure scrollbar rect is bounded by the tab view frame. - if (rect.origin.y < tabViewFrame.origin.y) + if (rect.origin.y < tabViewFrame.origin.y) { + rect.size.height -= tabViewFrame.origin.y - rect.origin.y; rect.origin.y = tabViewFrame.origin.y; - else if (rect.origin.y > NSMaxY(tabViewFrame)) + } else if (rect.origin.y > NSMaxY(tabViewFrame)) rect.origin.y = NSMaxY(tabViewFrame); if (NSMaxY(rect) > NSMaxY(tabViewFrame)) rect.size.height -= NSMaxY(rect) - NSMaxY(tabViewFrame);