mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-27 22:10:23 +00:00
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:
parent
a1d0c4df55
commit
178b81c537
@ -135,6 +135,11 @@ static NSMutableDictionary *cellClassDictionary = nil;
|
||||
return [_cell isContinuous];
|
||||
}
|
||||
|
||||
-(BOOL)needsPanelToBecomeKey {
|
||||
// The Apple way
|
||||
return [_cell isSelectable];
|
||||
}
|
||||
|
||||
-(BOOL)refusesFirstResponder {
|
||||
return [_cell refusesFirstResponder];
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user