pushFocusView: must be given an object.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3134 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1998-10-27 16:01:33 +00:00
parent 79758f2570
commit 00bc3151f2

View file

@ -70,14 +70,23 @@ static NSString *nsview_thread_key = @"NSViewThreadKey";
if (stack == nil) if (stack == nil)
{ {
stack = [[NSMutableDictionary alloc] initWithCapacity: 4]; stack = [[NSMutableArray alloc] initWithCapacity: 4];
[dict setObject: stack forKey: nsview_thread_key]; [dict setObject: stack forKey: nsview_thread_key];
[stack release]; [stack release];
} }
[stack addObject: focusView]; [stack addObject: focusView];
} }
else
{
[NSException raise: NSInternalInconsistencyException
format: @"Attempt to push a 'nil' focus view on to stack."];
}
} }
/*
* Remove the top focusView for the current thread from the stack
* and return the new focusView (or nil if the stack is now empty).
*/
+ (NSView *)popFocusView + (NSView *)popFocusView
{ {
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary]; NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
@ -88,10 +97,13 @@ static NSString *nsview_thread_key = @"NSViewThreadKey";
{ {
unsigned count = [stack count]; unsigned count = [stack count];
if (count > 0)
{
[stack removeObjectAtIndex: --count];
}
if (count > 0) if (count > 0)
{ {
v = [stack objectAtIndex: --count]; v = [stack objectAtIndex: --count];
[stack removeObjectAtIndex: count];
} }
} }
return v; return v;