From b235f77f3976cc306f35c85fd1343b380511d4c0 Mon Sep 17 00:00:00 2001 From: o9000 Date: Sat, 30 May 2015 14:22:40 +0200 Subject: [PATCH] systray: Prevent triggering concurrent updates for the same icon --- src/systray/systraybar.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/systray/systraybar.c b/src/systray/systraybar.c index 4efca82..59d3df6 100644 --- a/src/systray/systraybar.c +++ b/src/systray/systraybar.c @@ -613,14 +613,18 @@ void systray_render_icon_now(void* t) } traywin->time_last_render.tv_sec = now.tv_sec; traywin->time_last_render.tv_nsec = now.tv_nsec; - traywin->render_timeout = NULL; if ( traywin->width == 0 || traywin->height == 0 ) { // reschedule rendering since the geometry information has not yet been processed (can happen on slow cpu) - systray_render_icon(traywin); + traywin->render_timeout = add_timeout(50, 0, systray_render_icon_now, traywin, &traywin->render_timeout); return; } + if (traywin->render_timeout) { + stop_timeout(traywin->render_timeout); + traywin->render_timeout = NULL; + } + int empty = 1; XImage *ximage = XGetImage(server.dsp, traywin->tray_id, 0, 0, traywin->width, traywin->height, AllPlanes, XYPixmap); if (ximage) {