From 86683aaa3277dba5d238c5e71a5ac3adcbbc6eb1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 29 Sep 2009 23:17:23 +0200 Subject: [PATCH] screen_play: repaint on playlist change When the playlist version changes, repaint the playlist screen. This fixes a regression from the patch "repaint hscrolling only if selected item is wide". --- src/screen_play.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/screen_play.c b/src/screen_play.c index fbabe10..3e4f05a 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -57,6 +57,7 @@ static bool must_scroll; #endif static struct mpdclient_playlist *playlist; +static unsigned visible_version = -1; static int current_song_id = -1; static list_window_t *lw = NULL; static guint timer_hide_cursor_id; @@ -71,13 +72,6 @@ playlist_repaint(void) wrefresh(lw->w); } -static void -playlist_repaint_if_active(void) -{ - if (screen_is_visible(&screen_playlist)) - playlist_repaint(); -} - static void playlist_changed_callback(struct mpdclient *c, int event, gpointer data) { @@ -97,7 +91,6 @@ playlist_changed_callback(struct mpdclient *c, int event, gpointer data) } list_window_check_selected(lw, c->playlist.list->len); - playlist_repaint_if_active(); } #ifndef NCMPC_MINI @@ -552,6 +545,8 @@ play_paint(void) #endif list_window_paint(lw, list_callback, NULL); + + visible_version = playlist->id; } static void @@ -577,6 +572,10 @@ play_update(struct mpdclient *c) enabled */ playlist_repaint(); #endif + } else if (visible_version != playlist->id) { + /* the playlist has changed, we must paint the new + version */ + playlist_repaint(); } } -- 2.30.2