systray: Prevent triggering concurrent updates for the same icon

This commit is contained in:
o9000
2015-05-30 14:22:40 +02:00
parent 1b4b0a8d8d
commit b235f77f39

View File

@@ -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_sec = now.tv_sec;
traywin->time_last_render.tv_nsec = now.tv_nsec; traywin->time_last_render.tv_nsec = now.tv_nsec;
traywin->render_timeout = NULL;
if ( traywin->width == 0 || traywin->height == 0 ) { if ( traywin->width == 0 || traywin->height == 0 ) {
// reschedule rendering since the geometry information has not yet been processed (can happen on slow cpu) // 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; return;
} }
if (traywin->render_timeout) {
stop_timeout(traywin->render_timeout);
traywin->render_timeout = NULL;
}
int empty = 1; int empty = 1;
XImage *ximage = XGetImage(server.dsp, traywin->tray_id, 0, 0, traywin->width, traywin->height, AllPlanes, XYPixmap); XImage *ximage = XGetImage(server.dsp, traywin->tray_id, 0, 0, traywin->width, traywin->height, AllPlanes, XYPixmap);
if (ximage) { if (ximage) {