From 3dd3b3fe567abbc004c344a519aa911cff31e568 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Sep 2008 08:48:31 +0200 Subject: [PATCH] screen_play: repaint if current song has changed The play_update() function was reduced too much: it didn't repaint the screen when the current song changed. Add check for that. Don't repaint the screen in center_playing_item(), make the caller do it. --- src/screen_play.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/screen_play.c b/src/screen_play.c index 5554129..4ee131c 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -130,8 +130,6 @@ center_playing_item(mpdclient_t *c) /* make sure the cursor is in the window */ lw->selected = lw->start+offset; list_window_check_selected(lw, length); - - playlist_repaint(c); } static void @@ -420,14 +418,17 @@ play_paint(mpdclient_t *c) static void play_update(mpdclient_t *c) { - /* center the cursor */ - if (options.auto_center) { - static int prev_song_id = 0; + static int prev_song_id; + int current_song_id = c->song != NULL ? c->song->id : 0; - if (c->song && prev_song_id != c->song->id) { + if (current_song_id != prev_song_id) { + prev_song_id = current_song_id; + + /* center the cursor */ + if (options.auto_center && current_song_id != 0) center_playing_item(c); - prev_song_id = c->song->id; - } + + playlist_repaint(c); } } @@ -505,6 +506,7 @@ play_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) return 1; case CMD_SCREEN_UPDATE: center_playing_item(c); + playlist_repaint(c); return 0; case CMD_LIST_MOVE_UP: -- 2.30.2