aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-26 08:48:31 +0200
committerMax Kellermann <max@duempel.org>2008-09-26 08:48:31 +0200
commit3dd3b3fe567abbc004c344a519aa911cff31e568 (patch)
tree265899af4ea54852df13c3f5b605c348db1a4eda
parent93a8274fc78abe78284398e1947a8b6c1c9ba611 (diff)
downloadmpd-3dd3b3fe567abbc004c344a519aa911cff31e568.tar.gz
mpd-3dd3b3fe567abbc004c344a519aa911cff31e568.tar.xz
mpd-3dd3b3fe567abbc004c344a519aa911cff31e568.zip
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.
-rw-r--r--src/screen_play.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/screen_play.c b/src/screen_play.c
index 555412905..4ee131c70 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: