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