Fix unhide error - now activates app irrespective of whether it was hidden.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5258 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-11-22 17:22:38 +00:00
parent dd6d960ba0
commit 25c9581630
3 changed files with 42 additions and 21 deletions

View file

@ -427,6 +427,7 @@ static NSCell* tileCell = nil;
NSArray *windows_list;
unsigned count;
unsigned i;
BOOL hadDuplicates = NO;
mainModelFile = [infoDict objectForKey: @"NSMainNibFile"];
if (mainModelFile && ![mainModelFile isEqual: @""])
@ -454,18 +455,6 @@ static NSCell* tileCell = nil;
/* Register our listener to incoming services requests etc. */
[listener registerAsServiceProvider];
/* Register self as observer to window events. */
[nc addObserver: self selector: @selector(_windowWillClose:)
name: NSWindowWillCloseNotification object: nil];
[nc addObserver: self selector: @selector(_windowDidBecomeKey:)
name: NSWindowDidBecomeKeyNotification object: nil];
[nc addObserver: self selector: @selector(_windowDidBecomeMain:)
name: NSWindowDidBecomeMainNotification object: nil];
[nc addObserver: self selector: @selector(_windowDidResignKey:)
name: NSWindowDidResignKeyNotification object: nil];
[nc addObserver: self selector: @selector(_windowDidResignMain:)
name: NSWindowDidResignMainNotification object: nil];
/*
* Establish the current key and main windows. We need to do this in case
* the windows were created and set to be key/main earlier - before the
@ -485,7 +474,9 @@ static NSCell* tileCell = nil;
}
else
{
NSLog(@"Duplicate keyWindow ignored");
hadDuplicates = YES;
NSDebugLog(@"Duplicate keyWindow ignored");
[win resignKeyWindow];
}
}
if ([win isMainWindow] == YES)
@ -496,11 +487,38 @@ static NSCell* tileCell = nil;
}
else
{
NSLog(@"Duplicate mainWindow ignored");
hadDuplicates = YES;
NSDebugLog(@"Duplicate mainWindow ignored");
[win resignMainWindow];
}
}
}
/*
* If there was more than one window set as key or main, we must make sure
* that the one we have recorded is the real one by making it become key/main
* again.
*/
if (hadDuplicates)
{
[_main_window resignMainWindow];
[_main_window becomeMainWindow];
[_key_window resignKeyWindow];
[_key_window becomeKeyWindow];
}
/* Register self as observer to window events. */
[nc addObserver: self selector: @selector(_windowWillClose:)
name: NSWindowWillCloseNotification object: nil];
[nc addObserver: self selector: @selector(_windowDidBecomeKey:)
name: NSWindowDidBecomeKeyNotification object: nil];
[nc addObserver: self selector: @selector(_windowDidBecomeMain:)
name: NSWindowDidBecomeMainNotification object: nil];
[nc addObserver: self selector: @selector(_windowDidResignKey:)
name: NSWindowDidResignKeyNotification object: nil];
[nc addObserver: self selector: @selector(_windowDidResignMain:)
name: NSWindowDidResignMainNotification object: nil];
[self activateIgnoringOtherApps: YES];
/* finish the launching post notification that launching has finished */
@ -1268,13 +1286,13 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
{
[self unhideWithoutActivation];
unhide_on_activation = NO;
if (app_is_active == NO)
{
/*
* Activation should make the applications menus visible.
*/
[self activateIgnoringOtherApps: YES];
}
}
if (app_is_active == NO)
{
/*
* Activation should make the applications menus visible.
*/
[self activateIgnoringOtherApps: YES];
}
}