summaryrefslogtreecommitdiff
path: root/src/daemon
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2026-03-21 12:06:06 -0400
committerVictor Kareh <[email protected]>2026-03-22 17:34:10 -0400
commit24562cc76211579c9169039dab5d337a4731cf6e (patch)
tree3e5a85959b33093c71d2ba888515e63aea2b1343 /src/daemon
parent3f72f66032c6f9b80fc22e15a2fb33804d000bc6 (diff)
downloadmate-notification-daemon-fix-close-reason.tar.bz2
mate-notification-daemon-fix-close-reason.tar.xz
daemon: Fix NotificationClosed signal reason for close buttonfix-close-reason
When clicking the close button on a notification, the D-Bus signal incorrectly sent reason=1 (expired) instead of reason=2 (dismissed). Fixed by setting a flag on the notification window in the close button callback before destroying it, and checking this flag in the callback to send the correct close reason. Fixes #129
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/daemon.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index e5033de..a7c63a6 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -756,8 +756,14 @@ static void _notification_destroyed_cb(GtkWindow* nw, NotifyDaemon* daemon)
/*
* This usually won't happen, but can if notification-daemon dies before
* all notifications are closed. Mark them as expired.
+ *
+ * But if instead the notification's close button was clicked, the
+ * "_user_closed" flag will be set on the window, so we send the
+ * correct reason.
*/
- _close_notification(daemon, NW_GET_NOTIFY_ID(nw), FALSE, NOTIFYD_CLOSED_EXPIRED);
+ gboolean user_closed = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(nw), "_user_closed"));
+ _close_notification(daemon, NW_GET_NOTIFY_ID(nw), FALSE,
+ user_closed ? NOTIFYD_CLOSED_USER : NOTIFYD_CLOSED_EXPIRED);
}
#ifdef HAVE_X11