From: Max Kellermann Date: Sun, 4 Oct 2009 16:24:00 +0000 (+0200) Subject: main: don't call mpdclient_update() for clock update X-Git-Tag: release-0.16~165 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0fdc462debade7b7a4e2ae1031172a870fb833b6;p=ncmpc.git main: don't call mpdclient_update() for clock update When the "update timer" is running because the clock is enabled, don't call mpdclient_update() in each tick. For the clock, it's enough to update MPD only when an idle event occurs. While MPD is playing, we still need MPD updates, beacuse we need the new "elapsed" time. --- diff --git a/src/main.c b/src/main.c index 2bc1b62..34fa355 100644 --- a/src/main.c +++ b/src/main.c @@ -213,7 +213,10 @@ check_reconnect(void); static void do_mpd_update(void) { - if (mpdclient_is_connected(mpd)) + if (mpdclient_is_connected(mpd) && + (mpd->source == NULL || mpd->events != 0 || + (mpd->status != NULL && + mpd_status_get_state(mpd->status) == MPD_STATE_PLAY))) mpdclient_update(mpd); #ifndef NCMPC_MINI