mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 02:50:48 +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
|
// Attach the popUp
|
||||||
[_cell attachPopUpWithFrame: _bounds
|
[_cell attachPopUpWithFrame: _bounds
|
||||||
inView: self];
|
inView: self];
|
||||||
|
|
||||||
p = [_window convertBaseToScreen: [theEvent locationInWindow]];
|
p = [_window convertBaseToScreen: [theEvent locationInWindow]];
|
||||||
p = [menuWindow convertScreenToBase: p];
|
p = [menuWindow convertScreenToBase: p];
|
||||||
|
@ -358,12 +358,18 @@ this to return nil to indicate that we have no context menu.
|
||||||
pressure: [theEvent pressure]];
|
pressure: [theEvent pressure]];
|
||||||
[NSApp sendEvent: e];
|
[NSApp sendEvent: e];
|
||||||
|
|
||||||
// Selection remains unchanged if selected item is disabled
|
// Get highlighted item index from _cell because NSMenuView:
|
||||||
// or mouse left menu.
|
// - 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];
|
highlightedItemIndex = [_cell indexOfSelectedItem];
|
||||||
if ((highlightedItemIndex >= 0
|
|
||||||
&& [[self itemAtIndex: highlightedItemIndex] isEnabled] == NO)
|
// Selection remains unchanged if selected item is disabled
|
||||||
|| highlightedItemIndex == lastSelectedItem)
|
// or mouse left menu (highlightedItemIndex == -1).
|
||||||
|
if ( highlightedItemIndex < 0
|
||||||
|
|| highlightedItemIndex == lastSelectedItem
|
||||||
|
|| [[self itemAtIndex: highlightedItemIndex] isEnabled] == NO)
|
||||||
{
|
{
|
||||||
[mr setHighlightedItemIndex: lastSelectedItem];
|
[mr setHighlightedItemIndex: lastSelectedItem];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue