diff --git a/AppKit/NSControl.m b/AppKit/NSControl.m index 537d3558..3c5d0a81 100755 --- a/AppKit/NSControl.m +++ b/AppKit/NSControl.m @@ -135,6 +135,11 @@ static NSMutableDictionary *cellClassDictionary = nil; return [_cell isContinuous]; } +-(BOOL)needsPanelToBecomeKey { + // The Apple way + return [_cell isSelectable]; +} + -(BOOL)refusesFirstResponder { return [_cell refusesFirstResponder]; } diff --git a/AppKit/NSView.m b/AppKit/NSView.m index d22c5596..c51a49bb 100755 --- a/AppKit/NSView.m +++ b/AppKit/NSView.m @@ -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 { diff --git a/AppKit/NSWindow.m b/AppKit/NSWindow.m index 0e755dd1..ace7da59 100755 --- a/AppKit/NSWindow.m +++ b/AppKit/NSWindow.m @@ -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