Code

screen_play: no song means id=-1
authorMax Kellermann <max@duempel.org>
Sun, 28 Sep 2008 08:57:11 +0000 (10:57 +0200)
committerMax Kellermann <max@duempel.org>
Sun, 28 Sep 2008 08:57:11 +0000 (10:57 +0200)
"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.

src/screen_play.c

index 25e82c7ee1011365691722ba3fa0cd265fe2ee51..1bc2034b82d7d26557b8fb6a3fe29576f6deb0ae 100644 (file)
@@ -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);