mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
NSObject and NSRunLoop updates for MacOS-X compatibility
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14349 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a9de34eb69
commit
c45f681d6d
4 changed files with 84 additions and 0 deletions
|
@ -1192,6 +1192,39 @@ if (0) {
|
|||
|
||||
@implementation NSObject (TimedPerformers)
|
||||
|
||||
/**
|
||||
* Cancels any perform operations set up for the specified target
|
||||
* in the current run loop.
|
||||
*/
|
||||
+ (void) cancelPreviousPerformRequestsWithTarget: (id)target
|
||||
{
|
||||
NSMutableArray *perf = [[NSRunLoop currentRunLoop] _timedPerformers];
|
||||
unsigned count = [perf count];
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
GSTimedPerformer *array[count];
|
||||
|
||||
IF_NO_GC(RETAIN(target));
|
||||
[perf getObjects: array];
|
||||
while (count-- > 0)
|
||||
{
|
||||
GSTimedPerformer *p = array[count];
|
||||
|
||||
if (p->target == target)
|
||||
{
|
||||
[perf removeObjectAtIndex: count];
|
||||
}
|
||||
}
|
||||
RELEASE(target);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels any perform operations set up for the specified target
|
||||
* in the current loop, but only if the vaslue of aSelector and argument
|
||||
* with which the performs were set up exactly match those supplied.
|
||||
*/
|
||||
+ (void) cancelPreviousPerformRequestsWithTarget: (id)target
|
||||
selector: (SEL)aSelector
|
||||
object: (id)arg
|
||||
|
@ -2087,6 +2120,45 @@ if (0) {
|
|||
forMode: (NSString*)mode];
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels any perform operations set up for the specified target
|
||||
* in the receiver.
|
||||
*/
|
||||
- (void) cancelPerformSelectorsWithTarget: (id) target
|
||||
{
|
||||
NSMapEnumerator enumerator;
|
||||
GSRunLoopCtxt *context;
|
||||
void *mode;
|
||||
|
||||
enumerator = NSEnumerateMapTable(_contextMap);
|
||||
|
||||
while (NSNextMapEnumeratorPair(&enumerator, &mode, (void**)&context))
|
||||
{
|
||||
if (context != nil)
|
||||
{
|
||||
GSIArray performers = context->performers;
|
||||
unsigned count = GSIArrayCount(performers);
|
||||
|
||||
while (count--)
|
||||
{
|
||||
GSRunLoopPerformer *p;
|
||||
|
||||
p = GSIArrayItemAtIndex(performers, count).obj;
|
||||
if (p->target == target)
|
||||
{
|
||||
GSIArrayRemoveItemAtIndex(performers, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NSEndMapTableEnumeration(&enumerator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels any perform operations set up for the specified target
|
||||
* in the receiver, but only if the vaslue of aSelector and argument
|
||||
* with which the performs were set up exactly match those supplied.
|
||||
*/
|
||||
- (void) cancelPerformSelector: (SEL)aSelector
|
||||
target: (id) target
|
||||
argument: (id) argument
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue