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:
Sergii Stoian 2003-03-25 19:58:19 +00:00
parent 97d6daf4dc
commit 360bfffc6f

View file

@ -1101,10 +1101,10 @@ _addLeftBorderOffsetToRect(NSRect aRect)
candidateMenu = [_menu supermenu];
while (candidateMenu
&& !NSMouseInRect (locationInScreenCoordinates,
[[candidateMenu window] frame],
NO) // not found yet
&& (! ([candidateMenu isTornOff]
&& ![candidateMenu isTransient])) // no root of display tree
[[candidateMenu window] frame],
NO) // not found yet
&& (! ([candidateMenu isTornOff]
&& ![candidateMenu isTransient])) // no root of display tree
&& [candidateMenu isAttached]) // has displayed parent
{
candidateMenu = [candidateMenu supermenu];
@ -1114,11 +1114,18 @@ _addLeftBorderOffsetToRect(NSRect aRect)
&& NSMouseInRect (locationInScreenCoordinates,
[[candidateMenu window] frame], NO))
{
// The call to fetch attachedMenu is not needed. But putting
// it here avoids flicker when we go back to an ancester meu
// and the attached menu is alreay correct.
// The call to fetch attachedMenu is not needed. But putting
// it here avoids flicker when we go back to an ancestor
// menu and the attached menu is already correct.
[[[candidateMenu attachedMenu] menuRepresentation]
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]
trackWithEvent: original];
}