@@ -341,13 +341,39 @@ void queues_notification_close_id(gint id, enum reason reason)
341341 }
342342}
343343
344+ void queues_notification_remove_id (gint id , enum reason reason )
345+ {
346+ struct notification * target = NULL ;
347+
348+ GQueue * allqueues [] = { displayed , waiting , history };
349+ for (size_t i = 0 ; i < sizeof (allqueues )/sizeof (GQueue * ); i ++ ) {
350+ for (GList * iter = g_queue_peek_head_link (allqueues [i ]); iter ;
351+ iter = iter -> next ) {
352+ struct notification * n = iter -> data ;
353+ if (n -> id == id ) {
354+ g_queue_remove (allqueues [i ], n );
355+ target = n ;
356+ break ;
357+ }
358+ }
359+ }
360+ if (target )
361+ signal_notification_removed (target , reason );
362+ }
363+
344364/* see queues.h */
345365void queues_notification_close (struct notification * n , enum reason reason )
346366{
347367 assert (n != NULL );
348368 queues_notification_close_id (n -> id , reason );
349369}
350370
371+ void queues_notification_remove (struct notification * n , enum reason reason )
372+ {
373+ assert (n != NULL );
374+ queues_notification_remove_id (n -> id , reason );
375+ }
376+
351377static void queues_destroy_notification (struct notification * n , gpointer user_data )
352378{
353379 (void )user_data ;
@@ -480,6 +506,13 @@ void queues_update(struct dunst_status status, gint64 time)
480506 continue ;
481507 }
482508
509+ if (n -> marked_for_removal ) {
510+ queues_notification_remove (n , n -> marked_for_removal );
511+ n -> marked_for_removal = 0 ;
512+ iter = nextiter ;
513+ continue ;
514+ }
515+
483516
484517 if (queues_notification_is_finished (n , status , time )) {
485518 queues_notification_close (n , REASON_TIME );
0 commit comments