mouseDown fix

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16427 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2003-04-11 10:35:36 +00:00
parent 5653681dcd
commit ca26a5ce28

View file

@ -340,7 +340,7 @@ this to return nil to indicate that we have no context menu.
// Attach the popUp
[_cell attachPopUpWithFrame: _bounds
inView: self];
inView: self];
p = [_window convertBaseToScreen: [theEvent locationInWindow]];
p = [menuWindow convertScreenToBase: p];
@ -358,12 +358,18 @@ this to return nil to indicate that we have no context menu.
pressure: [theEvent pressure]];
[NSApp sendEvent: e];
// Selection remains unchanged if selected item is disabled
// or mouse left menu.
// Get highlighted item index from _cell because NSMenuView:
// - tells to NSPopUpButtonCell about current selected item index;
// - sets own selected item index to -1;
//
// So, at this point [mr highlightedItemIndex] always = -1
highlightedItemIndex = [_cell indexOfSelectedItem];
if ((highlightedItemIndex >= 0
&& [[self itemAtIndex: highlightedItemIndex] isEnabled] == NO)
|| highlightedItemIndex == lastSelectedItem)
// Selection remains unchanged if selected item is disabled
// or mouse left menu (highlightedItemIndex == -1).
if ( highlightedItemIndex < 0
|| highlightedItemIndex == lastSelectedItem
|| [[self itemAtIndex: highlightedItemIndex] isEnabled] == NO)
{
[mr setHighlightedItemIndex: lastSelectedItem];
}