Patch for initial first responder stuff

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4965 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-10-04 06:18:17 +00:00
parent fd0f3bb8c0
commit 6bb0e97b93
5 changed files with 55 additions and 3 deletions

View file

@ -1,3 +1,27 @@
Mon Oct 4 1999 Nicola Pero <n.pero@mi.flashnet.it>
Implementation of 'initial first responder' stuff for NSWindow:
* Headers/AppKit/NSWindow.h: New instance variable
_initial_first_responder
* Source/NSWindow.m: ([-dealloc]), ([-initDefaults]),
([-encodeWithCoder:]), ([-decodeWithCoder:]): updated to take
account for the new ivar _initial_first_responder.
* Model/GMAppKit.m ([NSWindow -encodeWithModelArchiver:]): Added
initialFirstResponder
([NSWindow -initWithModelUnarchiver:]): idem
([NSPanel -encodeWithModelArchiver:]): idem
([NSPanel -initWithModelUnarchiver:]): idem
([NSSavePanel -encodeWithModelArchiver:]): idem
([NSSavePanel -initWithModelUnarchiver:]): idem
* Source/NSWindow.m ([-setInitialFirstResponder:]): implemented method.
([-initialFirstResponder]): implemented method.
* Source/NSWindow.m ([-display]): If there is no first_responder,
set it to _initial_first_responder (if non-nil).
Minor fixes:
* Source/GNUmakefile: Added missing AppKit/AppKitExceptions.h
* Source/NSOpenPanel.m ([+openPanel]): Set defaults after creating.
Tue Sep 28 1999 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSBrowser.m Fixed bug: ([-mouseDown:]): New method with a

View file

@ -95,6 +95,7 @@ extern NSSize NSTokenSize;
id content_view;
id first_responder;
id original_responder;
NSView *_initial_first_responder;
id delegate;
id _fieldEditor;
id _lastDragView;

View file

@ -255,7 +255,8 @@ AppKit/PSOperators.h \
AppKit/GSHelpManagerPanel.h \
AppKit/GSPasteboardServer.h \
AppKit/GSServicesManager.h \
AppKit/GSWraps.h
AppKit/GSWraps.h \
AppKit/AppKitExceptions.h
-include GNUmakefile.preamble

View file

@ -73,7 +73,8 @@ static NSOpenPanel *gnustep_gui_open_panel = nil;
//if( ![GMModel loadIMFile:@"SavePanel" owner:NSApp] )
[[NSOpenPanel alloc] _initWithoutGModel];
[gnustep_gui_open_panel _setDefaults];
[gnustep_gui_open_panel setTitle:@"Open"];
// [GMUnarchiver decodeClassName:@"NSSavePanel"

View file

@ -124,6 +124,7 @@ static SEL ctSel = @selector(_checkTrackingRectangles:forEvent:);
static IMP ccImp;
static IMP ctImp;
static Class responderClass;
static Class viewClass;
static NSMutableSet *autosaveNames;
static NSRecursiveLock *windowsLock;
@ -139,6 +140,7 @@ static NSRecursiveLock *windowsLock;
ccImp = [self instanceMethodForSelector: ccSel];
ctImp = [self instanceMethodForSelector: ctSel];
responderClass = [NSResponder class];
viewClass = [NSView class];
autosaveNames = [NSMutableSet new];
windowsLock = [NSRecursiveLock new];
}
@ -214,7 +216,8 @@ static NSRecursiveLock *windowsLock;
TEST_RELEASE(miniaturized_image);
TEST_RELEASE(window_title);
TEST_RELEASE(rectsBeingDrawn);
TEST_RELEASE(_initial_first_responder);
/*
* FIXME This should not be necessary - the views should have removed
* their drag types, so we should already have been removed.
@ -808,6 +811,9 @@ static NSRecursiveLock *windowsLock;
- (void) display
{
needs_display = NO;
if (!first_responder)
if (_initial_first_responder)
[self makeFirstResponder: _initial_first_responder];
/*
* inform first responder of it's status so it can set the focus to itself
*/
@ -1220,6 +1226,22 @@ static NSRecursiveLock *windowsLock;
return YES;
}
- (void) setInitialFirstResponder: (NSView *)aView
{
if ([aView isKindOfClass: viewClass])
{
if (_initial_first_responder)
[_initial_first_responder autorelease];
_initial_first_responder = [aView retain];
}
}
- (NSView *) initialFirstResponder
{
return _initial_first_responder;
}
/* Return mouse location in reciever's base coord system, ignores event
* loop status */
- (NSPoint) mouseLocationOutsideOfEventStream
@ -2100,6 +2122,7 @@ static NSRecursiveLock *windowsLock;
[aCoder encodeSize: minimum_size];
[aCoder encodeSize: maximum_size];
[aCoder encodeObject: miniaturized_image];
[aCoder encodeConditionalObject: _initial_first_responder];
[aCoder encodeValueOfObjCType: @encode(NSBackingStoreType) at: &backing_type];
[aCoder encodeValueOfObjCType: @encode(int) at: &window_level];
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &disable_flush_window];
@ -2141,6 +2164,7 @@ static NSRecursiveLock *windowsLock;
minimum_size = [aDecoder decodeSize];
maximum_size = [aDecoder decodeSize];
[aDecoder decodeValueOfObjCType: @encode(id) at: &miniaturized_image];
[aDecoder decodeValueOfObjCType: @encode(id) at: &_initial_first_responder];
[aDecoder decodeValueOfObjCType: @encode(NSBackingStoreType)
at: &backing_type];
[aDecoder decodeValueOfObjCType: @encode(int) at: &window_level];
@ -2205,6 +2229,7 @@ static NSRecursiveLock *windowsLock;
{
first_responder = nil;
original_responder = nil;
_initial_first_responder = nil;
delegate = nil;
window_num = 0;
gstate = 0;