mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 04:50:37 +00:00
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:
parent
5653681dcd
commit
ca26a5ce28
1 changed files with 12 additions and 6 deletions
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue