git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4591 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-07-14 19:31:28 +00:00
parent fc054337ac
commit ae3eeab2f6

View file

@ -23,10 +23,11 @@
*/ */
/* Implementation for NSNotificationQueue for GNUStep /* Implementation for NSNotificationQueue for GNUStep
Copyright (C) 1997 Free Software Foundation, Inc. Copyright (C) 1997-1999 Free Software Foundation, Inc.
Modified by: Richard Frith-Macdonald <richard@brainstorm.co.uk> Modified by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
Date: 1997 Date: 1997
Rewritten: 1999
This file is part of the GNUstep Base Library. This file is part of the GNUstep Base Library.
@ -122,7 +123,7 @@ currentList()
list->next = elem; list->next = elem;
} }
+ (void)unregisterQueue: (NSNotificationQueue*)q + (void) unregisterQueue: (NSNotificationQueue*)q
{ {
NotificationQueueList* list; NotificationQueueList* list;
@ -271,7 +272,7 @@ add_to_queue(
@implementation NSNotificationQueue @implementation NSNotificationQueue
+ (NSNotificationQueue*)defaultQueue + (NSNotificationQueue*) defaultQueue
{ {
NotificationQueueList *list; NotificationQueueList *list;
NSNotificationQueue *item; NSNotificationQueue *item;
@ -288,13 +289,13 @@ add_to_queue(
return item; return item;
} }
- (id)init - (id) init
{ {
return [self initWithNotificationCenter: return [self initWithNotificationCenter:
[NSNotificationCenter defaultCenter]]; [NSNotificationCenter defaultCenter]];
} }
- (id)initWithNotificationCenter: (NSNotificationCenter*)notificationCenter - (id) initWithNotificationCenter: (NSNotificationCenter*)notificationCenter
{ {
zone = [self zone]; zone = [self zone];
@ -309,11 +310,11 @@ add_to_queue(
return self; return self;
} }
- (void)dealloc - (void) dealloc
{ {
NSNotificationQueueRegistration* item; NSNotificationQueueRegistration *item;
// remove from classs instances list // remove from class instances list
[NotificationQueueList unregisterQueue: self]; [NotificationQueueList unregisterQueue: self];
// release self // release self
@ -331,7 +332,7 @@ add_to_queue(
/* Inserting and Removing Notifications From a Queue */ /* Inserting and Removing Notifications From a Queue */
- (void)dequeueNotificationsMatching: (NSNotification*)notification - (void) dequeueNotificationsMatching: (NSNotification*)notification
coalesceMask: (NSNotificationCoalescing)coalesceMask coalesceMask: (NSNotificationCoalescing)coalesceMask
{ {
NSNotificationQueueRegistration* item; NSNotificationQueueRegistration* item;
@ -340,7 +341,8 @@ add_to_queue(
id object = [notification object]; id object = [notification object];
// find in ASAP notification in queue // find in ASAP notification in queue
for (item = asapQueue->tail; item; item=next) { for (item = asapQueue->tail; item; item=next)
{
next = item->next; next = item->next;
if ((coalesceMask & NSNotificationCoalescingOnName) if ((coalesceMask & NSNotificationCoalescingOnName)
&& [name isEqual: item->name]) && [name isEqual: item->name])
@ -357,7 +359,8 @@ add_to_queue(
} }
// find in idle notification in queue // find in idle notification in queue
for (item = idleQueue->tail; item; item=next) { for (item = idleQueue->tail; item; item=next)
{
next = item->next; next = item->next;
if ((coalesceMask & NSNotificationCoalescingOnName) if ((coalesceMask & NSNotificationCoalescingOnName)
&& [name isEqual: item->name]) && [name isEqual: item->name])
@ -387,17 +390,17 @@ add_to_queue(
} }
} }
- (void)enqueueNotification: (NSNotification*)notification - (void) enqueueNotification: (NSNotification*)notification
postingStyle: (NSPostingStyle)postingStyle postingStyle: (NSPostingStyle)postingStyle
{ {
[self enqueueNotification: notification [self enqueueNotification: notification
postingStyle: postingStyle postingStyle: postingStyle
coalesceMask: NSNotificationCoalescingOnName + coalesceMask: NSNotificationCoalescingOnName
NSNotificationCoalescingOnSender + NSNotificationCoalescingOnSender
forModes: nil]; forModes: nil];
} }
- (void)enqueueNotification: (NSNotification*)notification - (void) enqueueNotification: (NSNotification*)notification
postingStyle: (NSPostingStyle)postingStyle postingStyle: (NSPostingStyle)postingStyle
coalesceMask: (NSNotificationCoalescing)coalesceMask coalesceMask: (NSNotificationCoalescing)coalesceMask
forModes: (NSArray*)modes forModes: (NSArray*)modes
@ -406,7 +409,8 @@ add_to_queue(
[self dequeueNotificationsMatching: notification [self dequeueNotificationsMatching: notification
coalesceMask: coalesceMask]; coalesceMask: coalesceMask];
switch (postingStyle) { switch (postingStyle)
{
case NSPostNow: case NSPostNow:
[self postNotification: notification forModes: modes]; [self postNotification: notification forModes: modes];
break; break;