Fixed the tracking of mouse at horizontal menu

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31844 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Germán Arias 2011-01-07 05:27:29 +00:00
parent fe64bf3e97
commit a803a8f4c2
2 changed files with 29 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2011-01-06 German Arias <german@xelalug.org>
* Source/NSMenuView.m (-locationForSubmenu:, -trackWithEvent:):
Fixed the tracking of mouse at horizontal menu.
2011-01-04 Doug Simons <doug.simons@testplant.com>
* Source/NSSearchFieldCell.m:

View file

@ -1071,7 +1071,9 @@ static NSMapTable *viewInfo = 0;
[_attachedMenu indexOfItemWithSubmenu: aSubmenu]] toView: nil];
NSPoint subOrigin = [_window convertBaseToScreen: aRect.origin];
return NSMakePoint(subOrigin.x, subOrigin.y - NSHeight(submenuFrame));
/*We add +1 for don't lose the track when the user move the
mouse from the horizontal menu to a submenu.*/
return NSMakePoint(subOrigin.x, subOrigin.y - NSHeight(submenuFrame) + 1);
}
}
@ -1618,6 +1620,27 @@ static NSMapTable *viewInfo = 0;
}
return subMenuResult;
}
/*We track the menu correctly when this is located
in a window*/
if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", self) ==
NSWindows95InterfaceStyle)
{
if ([self hitTest: location] == nil)
{
[[[[NSApp mainWindow] menu] attachedMenu] close];
shouldFinish = YES;
return NO;
}
if (self != [[[NSApp mainWindow] menu] menuRepresentation])
{
[self setHighlightedItemIndex: -1];
shouldFinish = YES;
return [[[[NSApp mainWindow] menu] menuRepresentation]
trackWithEvent: original];
}
}
}
// 4 - We changed the selected item and should update.