From 2787f9f19be14ebaa3e3bbb42428f701de83078a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 20 Aug 2020 14:25:07 +0530 Subject: [PATCH] Drain the notifications queue in FIFO --- kitty/cocoa_window.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kitty/cocoa_window.m b/kitty/cocoa_window.m index e1566ee0c..0af66d93b 100644 --- a/kitty/cocoa_window.m +++ b/kitty/cocoa_window.m @@ -198,9 +198,14 @@ queue_notification(const char *identifier, const char *title, const char* body) static void drain_pending_notifications(BOOL granted) { + if (granted) { + for (size_t i = 0; i < notification_queue.count; i++) { + QueuedNotification *n = notification_queue.notifications + i; + schedule_notification(n->identifier, n->title, n->body); + } + } while(notification_queue.count) { QueuedNotification *n = notification_queue.notifications + --notification_queue.count; - if (granted) schedule_notification(n->identifier, n->title, n->body); free(n->identifier); free(n->title); free(n->body); n->identifier = NULL; n->title = NULL; n->body = NULL; }