Revert previous first-responder-on-click change and implement NSView & NSControl needsPanelToBecomeKey the Apple way (which is different from the Apple doc way...)

This commit is contained in:
Airy ANDRE 2014-08-25 19:38:34 +02:00
parent a1d0c4df55
commit 178b81c537
3 changed files with 8 additions and 3 deletions

View File

@ -135,6 +135,11 @@ static NSMutableDictionary *cellClassDictionary = nil;
return [_cell isContinuous];
}
-(BOOL)needsPanelToBecomeKey {
// The Apple way
return [_cell isSelectable];
}
-(BOOL)refusesFirstResponder {
return [_cell refusesFirstResponder];
}

View File

@ -516,8 +516,9 @@ static inline void buildTransformsIfNeeded(NSView *self) {
return [self acceptsFirstResponder] && ![self isHiddenOrHasHiddenAncestor];
}
// Cocoa does that for views, despite the "The default implementation returns NO" from the documentation
-(BOOL)needsPanelToBecomeKey {
return NO;
return [self acceptsFirstResponder];
}
-(NSView *)nextKeyView {

View File

@ -2141,9 +2141,8 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
if([view acceptsFirstResponder]){
if([view needsPanelToBecomeKey]) {
[self becomeKeyWindow];
[self makeFirstResponder:view];
}
[self makeFirstResponder:view];
}
// Event goes to view, not first responder