diff --git a/ChangeLog b/ChangeLog index a44fd778b..cf3df3231 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-12-30 Wolfgang Lux + + * Source/NSMenuView.m (-trackWithEvent:): + Make pop up menus in Macintosh menu style behave more similar to + OS X. In particular, when the user clicks the button, the menu + stays open until the next click. + 2010-12-30 Wolfgang Lux * Source/NSMenuView.m (-update): diff --git a/Source/NSMenuView.m b/Source/NSMenuView.m index 39e891178..fcd926075 100644 --- a/Source/NSMenuView.m +++ b/Source/NSMenuView.m @@ -1465,7 +1465,15 @@ static NSMapTable *viewInfo = 0; eventMask |= NSLeftMouseDownMask; } - if ([self isHorizontal] == YES) + /* We attempt to mimic Mac OS X behavior for pop up menus. If the user + presses the mouse button over a pop up button and then drags the mouse + over the menu, the is closed when the user releases the mouse. On the + other hand, when the user clicks on the button and then moves the mouse + the menu is closed upon the next mouse click. */ + if ([self isHorizontal] == YES || + ([[self menu] _ownedByPopUp] == YES && + NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", self) + == NSMacintoshInterfaceStyle)) { /* * Ignore the first mouse up if nothing interesting has happened.