avoid weird behavior when pushing down action button by showing the menu on mouse up instead

This commit is contained in:
Mitchell Livingston 2008-01-17 04:20:52 +00:00
parent 52c3243b4b
commit 4158be90cf
2 changed files with 12 additions and 10 deletions

View File

@ -264,6 +264,7 @@ typedef enum
[[fOutline itemAtRow: i] objectForKey: @"Path"]] inFileViewerRootedAtPath: nil];
}
#warning make real view controller (Leopard-only) so that Command-R will work
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
{
if (!fTorrent)

View File

@ -229,6 +229,17 @@
{
NSPoint point = [self convertPoint: [event locationInWindow] fromView: nil];
//if pushing a button, don't change the selected rows
if ([NSApp isOnLeopardOrBetter] && ([self pointInControlRect: point] || [self pointInRevealRect: point]
|| [self pointInActionRect: point]))
fSelectedIndexes = [[self selectedRowIndexes] retain];
[super mouseDown: event];
[fSelectedIndexes release];
fSelectedIndexes = nil;
//avoid weird behavior when showing menu by doing this after mouse down
if ([self pointInActionRect: point])
{
int row = [self rowAtPoint: point];
@ -242,16 +253,6 @@
[self setNeedsDisplayInRect: [self rectOfRow: row]];
}
//if pushing a button, don't change the selected rows
if ([NSApp isOnLeopardOrBetter] && ([self pointInControlRect: point] || [self pointInRevealRect: point]
|| [self pointInActionRect: point]))
fSelectedIndexes = [[self selectedRowIndexes] retain];
[super mouseDown: event];
[fSelectedIndexes release];
fSelectedIndexes = nil;
if ([self pointInMinimalStatusRect: point])
{
[fDefaults setBool: ![fDefaults boolForKey: @"DisplaySmallStatusRegular"] forKey: @"DisplaySmallStatusRegular"];