fix problem of pulldown action not being called for correct cell, and being called twice on Windows

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31213 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Doug Simons 2010-08-30 23:02:21 +00:00
parent 545782e338
commit 56e074cdb8
3 changed files with 21 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2010-08-30 Doug Simons <doug.simons@testplant.com>
* Source/NSPopUpButtonCell.m:
Fix problem of pulldown action not being called with correct cell
selected (possibly only a problem for Mac nib files?).
* Source/NSMenuView.m:
Fix problem of pulldown action getting invoked twice on Windows.
2010-08-30 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSTableView.m (computeNewSelection): Fix bug where the

View file

@ -1452,6 +1452,13 @@ static NSMapTable *viewInfo = 0;
NSEvent *original;
NSEventType type;
NSEventType end;
NSPopUpButtonCell *bcell = nil;
SEL bcellAction = NULL;
if([_attachedMenu _ownedByPopUp])
{
bcell = [_attachedMenu _owningPopUp];
bcellAction = [bcell action];
}
/*
* The original event is unused except to determine whether the method
@ -1656,11 +1663,13 @@ static NSMapTable *viewInfo = 0;
lastLocation = location;
}
[bcell setAction:NULL]; // block actions while fetching an event (this is a problem on Windows)
event = [NSApp nextEventMatchingMask: eventMask
untilDate: theDistantFuture
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
type = [event type];
[bcell setAction:bcellAction]; // restore the popUpButtonCell's action
}
while (type != end || shouldFinish == NO);

View file

@ -1304,6 +1304,10 @@ static NSImage *_pbc_image[5];
*/
- (void) _popUpItemAction: (id)sender
{
// first, if sender is one of our items, set it as our selected item
int index = [_menu indexOfItem:sender];
if (index != NSNotFound)
[self selectItemAtIndex:index];
[NSApp sendAction: [self action] to: [self target] from: self];
}