From dcd45f06775ef7a5ab2a559c81937970c185e369 Mon Sep 17 00:00:00 2001 From: Stu Black Date: Sat, 1 Nov 2025 15:50:17 -0400 Subject: [PATCH] Make some unused public WMNotification APIs private. `WMRetainNotification`, `WMGetDefaultNotificationQueue`, `WMDequeueNotificationMatching`, `WMEnqueueNotification`, and `WMEnqueueCoalesceNotification`, are only used in WINGs/notification.c. To reduce the API surface area that needs to be migrated to Rust, they are being made private. --- WINGs/WINGs/WUtil.h | 20 +------------------- WINGs/notification.c | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h index 060c1adb..224add25 100644 --- a/WINGs/WINGs/WUtil.h +++ b/WINGs/WINGs/WUtil.h @@ -596,15 +596,13 @@ WMTreeNode *WMFindInTreeWithDepthLimit(WMTreeNode * aTree, int (*match)(const WM /* Walk every node of aNode with `walk' */ void WMTreeWalk(WMTreeNode *aNode, WMTreeWalkProc * walk, void *data); -/* ---[ WINGs/data.c ]---------------------------------------------------- */ +/* ---[ WINGs/notification.c ]---------------------------------------------------- */ WMNotification* WMCreateNotification(const char *name, void *object, void *clientData); void WMReleaseNotification(WMNotification *notification); -WMNotification* WMRetainNotification(WMNotification *notification); - void* WMGetNotificationClientData(WMNotification *notification); void* WMGetNotificationObject(WMNotification *notification); @@ -624,24 +622,8 @@ void WMRemoveNotificationObserverWithName(void *observer, const char *name, void WMPostNotificationName(const char *name, void *object, void *clientData); -WMNotificationQueue* WMGetDefaultNotificationQueue(void); - WMNotificationQueue* WMCreateNotificationQueue(void); -void WMDequeueNotificationMatching(WMNotificationQueue *queue, - WMNotification *notification, - unsigned mask); - -void WMEnqueueNotification(WMNotificationQueue *queue, - WMNotification *notification, - WMPostingStyle postingStyle); - -void WMEnqueueCoalesceNotification(WMNotificationQueue *queue, - WMNotification *notification, - WMPostingStyle postingStyle, - unsigned coalesceMask); - - /* Property Lists handling */ /* ---[ WINGs/proplist.c ]------------------------------------------------ */ diff --git a/WINGs/notification.c b/WINGs/notification.c index d43fef54..7cfaac21 100644 --- a/WINGs/notification.c +++ b/WINGs/notification.c @@ -16,6 +16,19 @@ typedef struct W_Notification { } Notification; +static WMNotification* WMRetainNotification(WMNotification *notification); +static WMNotificationQueue* WMGetDefaultNotificationQueue(void); +static void WMDequeueNotificationMatching(WMNotificationQueue *queue, + WMNotification *notification, + unsigned mask); +static void WMEnqueueNotification(WMNotificationQueue *queue, + WMNotification *notification, + WMPostingStyle postingStyle); +static void WMEnqueueCoalesceNotification(WMNotificationQueue *queue, + WMNotification *notification, + WMPostingStyle postingStyle, + unsigned coalesceMask); + const char *WMGetNotificationName(WMNotification * notification) { return notification->name; @@ -53,7 +66,7 @@ void WMReleaseNotification(WMNotification * notification) } } -WMNotification *WMRetainNotification(WMNotification * notification) +static WMNotification *WMRetainNotification(WMNotification * notification) { notification->refCount++; @@ -365,7 +378,7 @@ static WMNotificationQueue *notificationQueueList = NULL; /* default queue */ static WMNotificationQueue *notificationQueue = NULL; -WMNotificationQueue *WMGetDefaultNotificationQueue(void) +static WMNotificationQueue *WMGetDefaultNotificationQueue(void) { if (!notificationQueue) notificationQueue = WMCreateNotificationQueue(); @@ -387,7 +400,7 @@ WMNotificationQueue *WMCreateNotificationQueue(void) return queue; } -void WMEnqueueNotification(WMNotificationQueue * queue, WMNotification * notification, WMPostingStyle postingStyle) +static void WMEnqueueNotification(WMNotificationQueue * queue, WMNotification * notification, WMPostingStyle postingStyle) { WMEnqueueCoalesceNotification(queue, notification, postingStyle, WNCOnName | WNCOnSender); } @@ -413,7 +426,7 @@ static int matchName(const void *item, const void *cdata) #undef NOTIF #undef ITEM -void WMDequeueNotificationMatching(WMNotificationQueue * queue, WMNotification * notification, unsigned mask) +static void WMDequeueNotificationMatching(WMNotificationQueue * queue, WMNotification * notification, unsigned mask) { WMMatchDataProc *matchFunc; @@ -430,7 +443,7 @@ void WMDequeueNotificationMatching(WMNotificationQueue * queue, WMNotification * WMRemoveFromArrayMatching(queue->idleQueue, matchFunc, notification); } -void +static void WMEnqueueCoalesceNotification(WMNotificationQueue * queue, WMNotification * notification, WMPostingStyle postingStyle, unsigned coalesceMask) {