From: Max Kellermann Date: Sun, 28 Sep 2008 08:57:11 +0000 (+0200) Subject: screen_play: no song means id=-1 X-Git-Tag: v0.12_alpha1~135 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d97634730540ae063746c5c59dc87d7299719171;p=ncmpc.git screen_play: no song means id=-1 "prev_song_id" and "current_song_id" had value 0 if MPD was not playing at all. This way, ncmpc cannot see the difference between "song 0 playing" and "not playing". Change "not playing" to -1. --- diff --git a/src/screen_play.c b/src/screen_play.c index 25e82c7..1bc2034 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -418,15 +418,15 @@ play_paint(mpdclient_t *c) static void play_update(mpdclient_t *c) { - static int prev_song_id; + static int prev_song_id = -1; int current_song_id = c->song != NULL && c->status != NULL && - !IS_STOPPED(c->status->state) ? c->song->id : 0; + !IS_STOPPED(c->status->state) ? c->song->id : -1; if (current_song_id != prev_song_id) { prev_song_id = current_song_id; /* center the cursor */ - if (options.auto_center && current_song_id != 0) + if (options.auto_center && current_song_id != -1) center_playing_item(c); playlist_repaint(c);