mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-03 19:31:07 +00:00
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:
parent
79758f2570
commit
00bc3151f2
1 changed files with 14 additions and 2 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue