Change criterion for focusing find string when dialog is open

We now move focus to the find string unless the window is visible, key, and focus is already in a text field (technically an NSTextView).
This commit is contained in:
Allan Odgaard
2013-03-13 12:37:22 +01:00
parent db5df4a58c
commit f553f20cc7

View File

@@ -525,9 +525,9 @@ static NSButton* OakCreateButton (NSString* label, NSBezelStyle bezel = NSRounde
- (void)showWindow:(id)sender
{
BOOL isVisible = [self isWindowLoaded] && [self.window isVisible];
BOOL isVisibleAndKey = [self isWindowLoaded] && [self.window isVisible] && [self.window isKeyWindow];
[super showWindow:sender];
if(!isVisible)
if(!isVisibleAndKey || ![[self.window firstResponder] isKindOfClass:[NSTextView class]])
[self.window makeFirstResponder:self.findTextField];
}