diff --git a/ChangeLog b/ChangeLog index 8cc958353..e6ac616c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-02-04 Matt Rice + + * Source/NSTableView.m (-mouseDown:): Return early after tracking a + cell which prefersTrackingUntilMouseUp. + * Source/NSPopUpButtonCell.m (+prefersTrackingUntilMouseUp:): Return + yes. + (-trackMouse:inRect:ofView:untilMouseUp:): Return yes or no + depending on whether the mouse went up inside the menu or not. + Fixes bug #18946 + 2007-01-31 Richard Frith-Macdoanld * Source/GSFontInfo.m: diff --git a/Source/NSPopUpButtonCell.m b/Source/NSPopUpButtonCell.m index d5af3d89d..b273a6db7 100644 --- a/Source/NSPopUpButtonCell.m +++ b/Source/NSPopUpButtonCell.m @@ -51,6 +51,11 @@ static NSImage *_pbc_image[2]; } } ++ (BOOL) prefersTrackingUntilMouseUp +{ + return YES; +} + // Initialization /** * Initialize a blank cell. @@ -838,9 +843,10 @@ static NSImage *_pbc_image[2]; if ([[_menu window] isVisible]) { [self dismissPopUp]; + return NO; } - return NO; + return YES; } /** diff --git a/Source/NSTableView.m b/Source/NSTableView.m index e814e8e4d..81233031e 100644 --- a/Source/NSTableView.m +++ b/Source/NSTableView.m @@ -3703,14 +3703,27 @@ static inline float computePeriod(NSPoint mouseLocationWin, * Can never get here from a dragging source * so they need to track in mouse up. */ - - // FIXME we probably want to return from here - // if the cell wants to track until mouse up, - // which could cause selections if the mouse leaves the - // cell frame? + NSTableColumn *tb; + NSCell *cell; + + tb = [_tableColumns objectAtIndex: _clickedColumn]; + cell = [tb dataCellForRow: _clickedRow]; + [self _trackCellAtColumn: _clickedColumn row: _clickedRow withEvent: theEvent]; + + if ([[cell class] prefersTrackingUntilMouseUp]) + { + /* the mouse could have gone up outside of the cell + * avoid selecting the row under mouse cursor */ + + /* FIXME this should really send the action + * unfortunately the row isn't currently being + * selected so that would send the action on the + * wrong row. */ + return; + } } /* * Since we may have tracked a cell which may have caused