I have main window and several child windows, i would like to show main window when user click on dock icon, but without making it a key window, if there just was one (it will become automatically key if there is no key window).
Here is current code:
if ( fMainWinDelegate ) {
if (not [NSApp keyWindow]) {
NSLog(@"AppDelegate::applicationShouldHandleReopen [fMainWinDelegate showWindow]");
[fMainWinDelegate showWindow];
}
else {
if ([fMainWinDelegate.window isMiniaturized]) {
NSLog(@"AppDelegate::applicationShouldHandleReopen [fMainWinDelegate.window deminiaturize:self]");
[fMainWinDelegate.window deminiaturize:self];
//this one is not working, it make window also the key window
}
else if (not [fMainWinDelegate.window isVisible] && not [fMainWinDelegate.window isMiniaturized]) {
NSLog(@"AppDelegate::applicationShouldHandleReopen [fMainWinDelegate.window orderFront:self]");
[fMainWinDelegate.window orderFront:self];
}
}
}