diff --git a/ChangeLog b/ChangeLog index d8afe3d87..a43068275 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-04-10 00:53-EDT Gregory John Casamento + + * Source/NSMenuView.m: In the method + - (void) setWindowFrameForAttachingToRect:... changed how + popup/pulldown buttons handle the preferred edge. + Per Cocoa documentation, the selected cell should always show up + over the button for popups. For pull down menus, the preferred + edge is relevant. This is also apparent from testing under Cocoa. + 2009-04-09 22:55-EDT Gregory John Casamento * Source/NSRulerMarker.m: Changes suggested by Doug Simons for diff --git a/Source/NSMenuView.m b/Source/NSMenuView.m index 6ed9091bc..0233c6946 100644 --- a/Source/NSMenuView.m +++ b/Source/NSMenuView.m @@ -1154,29 +1154,38 @@ static NSMapTable *viewInfo = 0; } // Update position, if needed, using the preferredEdge - if (edge == NSMinYEdge) + if([_attachedMenu _ownedByPopUp]) { -/* - if ([_attachedMenu _ownedByPopUp] && - ([[_attachedMenu _owningPopUp] pullsDown])) - { - screenFrame.origin.y -= screenRect.size.height; - } -*/ + // Per Cocoa documentation, the selected cell should always show up + // over the button for popups. For pull down menus, the preferred + // edge is relevant. This is also apparent from testing under Cocoa. + if([[_attachedMenu _owningPopUp] pullsDown]) + { + if (edge == NSMinYEdge) + { + /* + if ([_attachedMenu _ownedByPopUp] && + ([[_attachedMenu _owningPopUp] pullsDown])) + { + screenFrame.origin.y -= screenRect.size.height; + } + */ + } + else if (edge == NSMaxYEdge) + { + screenFrame.origin.y += screenRect.size.height; + } + else if (edge == NSMaxXEdge) + { + screenFrame.origin.x += screenRect.size.width; + } + else if (edge == NSMinXEdge) + { + screenFrame.origin.x -= screenRect.size.width; + } + } } - else if (edge == NSMaxYEdge) - { - screenFrame.origin.y += screenRect.size.height; - } - else if (edge == NSMaxXEdge) - { - screenFrame.origin.x += screenRect.size.width; - } - else if (edge == NSMinXEdge) - { - screenFrame.origin.x -= screenRect.size.width; - } - + // Get the frameRect r = [NSWindow frameRectForContentRect: screenFrame styleMask: [_window styleMask]];