reset highlighted items in a submenu that we leave for a supermenu

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16264 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
stoyan 2003-03-25 19:58:19 +00:00
parent c44ad09003
commit 1d95456d95

View file

@ -1101,10 +1101,10 @@ _addLeftBorderOffsetToRect(NSRect aRect)
candidateMenu = [_menu supermenu]; candidateMenu = [_menu supermenu];
while (candidateMenu while (candidateMenu
&& !NSMouseInRect (locationInScreenCoordinates, && !NSMouseInRect (locationInScreenCoordinates,
[[candidateMenu window] frame], [[candidateMenu window] frame],
NO) // not found yet NO) // not found yet
&& (! ([candidateMenu isTornOff] && (! ([candidateMenu isTornOff]
&& ![candidateMenu isTransient])) // no root of display tree && ![candidateMenu isTransient])) // no root of display tree
&& [candidateMenu isAttached]) // has displayed parent && [candidateMenu isAttached]) // has displayed parent
{ {
candidateMenu = [candidateMenu supermenu]; candidateMenu = [candidateMenu supermenu];
@ -1114,11 +1114,18 @@ _addLeftBorderOffsetToRect(NSRect aRect)
&& NSMouseInRect (locationInScreenCoordinates, && NSMouseInRect (locationInScreenCoordinates,
[[candidateMenu window] frame], NO)) [[candidateMenu window] frame], NO))
{ {
// The call to fetch attachedMenu is not needed. But putting // The call to fetch attachedMenu is not needed. But putting
// it here avoids flicker when we go back to an ancester meu // it here avoids flicker when we go back to an ancestor
// and the attached menu is alreay correct. // menu and the attached menu is already correct.
[[[candidateMenu attachedMenu] menuRepresentation] [[[candidateMenu attachedMenu] menuRepresentation]
detachSubmenu]; detachSubmenu];
// Reset highlighted index for this menu.
// This way if we return to this submenu later there
// won't be a highlighted item.
[[[candidateMenu attachedMenu] menuRepresentation]
setHighlightedItemIndex: -1];
return [[candidateMenu menuRepresentation] return [[candidateMenu menuRepresentation]
trackWithEvent: original]; trackWithEvent: original];
} }