From c6ccf1d4872fa15b2ce217a27fe423cef74aa8a2 Mon Sep 17 00:00:00 2001 From: cacaodev Date: Thu, 26 Jul 2012 17:54:31 +0200 Subject: [PATCH] -rowForView: early return if arg is not a CPView. Was causing an error when you click on table whose window was not frontmost. Simplify -hitTest:, limit select-row behavior to left mouse events and extend to all data views accepting FR. --- AppKit/CPTableView.j | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index ef0e47d99..34008e39c 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -1870,6 +1870,9 @@ NOT YET IMPLEMENTED */ - (CPInteger)rowOrColumn:(BOOL)rowOrColumn forView:(CPView)aView { + if (![aView isKindOfClass:[CPView class]]) + return -1; + var cellView = aView, contentView = [[self window] contentView]; @@ -4821,10 +4824,10 @@ Your delegate can implement this method to avoid subclassing the tableview to ad { var hit = [super hitTest:aPoint]; - if (!hit || ![hit isKindOfClass:[CPTextField class]] || [self isRowSelected:[self rowForView:hit]]) - return hit; + if ([[CPApp currentEvent] type] == CPLeftMouseDown && [hit acceptsFirstResponder] && ![self isRowSelected:[self rowForView:hit]]) + return self; - return self; + return hit; } - (void)_startObservingFirstResponder