Reinstate changes to NSWindow.m to keep it working.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3480 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1998-12-17 13:06:17 +00:00
parent ed8cb51bc9
commit 582f5f44ad
2 changed files with 671 additions and 658 deletions

View file

@ -1,3 +1,8 @@
Thu Dec 17 13:20:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* NSWindow.m: Reinstated changes lost in last update (to fix
recursion problem on menu creation) and added acceptsFirstResponder.
Wed Dec 16 1998 Felipe A. Rodriguez <far@ix.netcom.com>
* NSWindow.m acceptsFirstResponder implement.

View file

@ -192,9 +192,9 @@ NSRect cframe;
cframe.origin = NSZeroPoint; // Create the content view
cframe.size = frame.size;
[self setContentView:[[[NSView alloc] initWithFrame:cframe] autorelease]];
// Register ourselves with
// the Application object
[theApp addWindowsItem:self title:window_title filename:NO];
[theApp addWindowsItem: self title: nil filename: NO];
_flushRectangles = [[NSMutableArray alloc] initWithCapacity:10];
@ -252,7 +252,11 @@ NSView *wv;
ASSIGN(represented_filename, aString);
}
- (void)setTitle:(NSString *)aString { ASSIGN(window_title,aString); }
- (void) setTitle: (NSString*)aString
{
ASSIGN(window_title, aString);
[self setMiniwindowTitle: aString];
}
- (void) setTitleWithRepresentedFilename: (NSString*)aString
{
@ -291,7 +295,7 @@ NSView *wv;
ASSIGN(miniaturized_image, image);
}
- (void)setMiniwindowTitle:(NSString *)title;
- (void) setMiniwindowTitle: (NSString*)title
{
BOOL isDoc = NO;
@ -300,7 +304,6 @@ BOOL isDoc = NO;
title = window_title;
if ([title isEqual: represented_filename])
isDoc = YES;
[[NSApplication sharedApplication] changeWindowsItem: self
title: title
filename: isDoc];
@ -503,7 +506,6 @@ NSPoint basePoint;
visible = YES;
needs_display = NO; // inform first responder
// of it's status so it can
if(first_responder)
[first_responder becomeFirstResponder]; // set the focus to itself
[self disableFlushWindow]; // tmp disable display
@ -627,21 +629,22 @@ NSView *v;
{
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
NSApplication *theApp = [NSApplication sharedApplication];
// Notify delegate
/*
* If 'is_released_when_closed' then the window will be removed from the
* applications list of windows (causing it to be released) - so we must
* bracket any work we do in a retain/release sequence.
*/
if (is_released_when_closed)
[self retain];
[nc postNotificationName: NSWindowWillCloseNotification object: self];
[theApp removeWindowsItem: self];
[self orderOut: self];
visible = NO;
// if app has no
if(![theApp mainMenu]) // menu terminate
[theApp terminate:self];
else
{ // else if should
if (is_released_when_closed) // release do so
{ // default is YES
[theApp removeWindowsItem: self]; // for windows and
[self autorelease]; // NO for panels
}
}
if (is_released_when_closed)
[self release];
}
- (void)deminiaturize:sender
@ -721,15 +724,15 @@ NSApplication *theApp = [NSApplication sharedApplication];
[theApp discardEventsMatchingMask:mask beforeEvent:lastEvent];
}
- (NSResponder *)firstResponder { return first_responder; }
- (BOOL)acceptsFirstResponder { return YES; }
- (NSResponder*) firstResponder
{
return first_responder;
}
- (void)keyDown:(NSEvent *)theEvent // save the first responder
{ // so that the key up goes
original_responder = first_responder; // to it and not a possible
// new first responder
[first_responder keyDown:theEvent]; // Send the first responder
} // the key down
- (BOOL) acceptsFirstResponder
{
return YES;
}
- (BOOL) makeFirstResponder: (NSResponder*)aResponder
{
@ -972,8 +975,13 @@ NSView *v;
case NSMouseExited: // Mouse exited
break;
case NSKeyDown: // Key down
[self keyDown:theEvent];
case NSKeyDown:
/*
* Save the first responder so that the key up goes to it and not a
* possible new first responder.
*/
original_responder = first_responder;
[first_responder keyDown: theEvent];
break;
case NSKeyUp: // Key up
@ -1362,7 +1370,7 @@ id result = nil;
is_key = NO;
is_main = NO;
is_edited = NO;
is_released_when_closed = NO;
is_released_when_closed = YES;
is_miniaturized = NO;
disable_flush_window = NO;
menu_exclude = NO;