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

@ -3,6 +3,7 @@ Mon Nov 22 17:05:33:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSApplication.m: Start listening for window notifications
whenm the app becomes active, and check to see which windows are key
and main.
([-unhide:]) fixed to activate app even if it wasn't hidden.
1999-11-21 Tim McIntosh <rockford@novia.net>

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];
}
}

View file

@ -1232,6 +1232,8 @@ resetCursorRectsForView(NSView *theView)
RETAIN(self);
[nc postNotificationName: NSWindowWillCloseNotification object: self];
[self resignKeyWindow];
[self resignMainWindow];
[NSApp removeWindowsItem: self];
[self orderOut: self];