From 8c026dd0861854774fadd528ff51672de8ca9145 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 29 Mar 2014 23:34:22 +0100 Subject: [PATCH] Avoid repeating the same mail in OSD announcements --- cm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cm.c b/cm.c index 49d0f65..e14c8fa 100644 --- a/cm.c +++ b/cm.c @@ -637,6 +637,7 @@ static Atom osd_pty; static unsigned osd_care; #define OSD_MSG_SIZE 1024 static char osd_last_msg[OSD_MSG_SIZE]; +static time_t osd_last_time; static void x11_init(void) @@ -844,7 +845,7 @@ rethink_osd(int notify) if (b->o.osd > 0) { p.total_new += b->new; - if (b->new && (!p.mbox || p.mbox->o.priority < b->o.priority)) + if (b->new && b->last_time > osd_last_time && (!p.mbox || p.mbox->o.priority < b->o.priority)) p.mbox = b; } @@ -862,6 +863,7 @@ rethink_osd(int notify) } else debug("OSD: No changes\n"); + osd_last_time = time(NULL); } } -- 2.39.5