diff options
author | Max Kellermann <max@duempel.org> | 2008-09-17 12:20:42 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-17 12:20:42 +0200 |
commit | fd7abf4f81a69014b0e1e967c7965996a11295b0 (patch) | |
tree | 539a4a746587dd3090642657c9304492a0f6017f /src/screen_play.c | |
parent | ca2b9d1390a56b89336b963113b5763edd70238e (diff) | |
download | mpd-fd7abf4f81a69014b0e1e967c7965996a11295b0.tar.gz mpd-fd7abf4f81a69014b0e1e967c7965996a11295b0.tar.xz mpd-fd7abf4f81a69014b0e1e967c7965996a11295b0.zip |
list_window: added list_window_center()
Merge code which used to be duplicated in the screens "play", "help",
"lyrics".
Diffstat (limited to '')
-rw-r--r-- | src/screen_play.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/screen_play.c b/src/screen_play.c index 6b4de7893..0426176d6 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -106,20 +106,15 @@ center_playing_item(mpdclient_t *c) /* try to center the song that are playing */ idx = playlist_get_index(c, c->song); D("Autocenter song id:%d pos:%d index:%d\n", c->song->id,c->song->pos,idx); - idx -= (lw->rows / 2); - if (idx + (int)lw->rows > (int)length) - idx = length - lw->rows; if (idx < 0) - idx = 0; - lw->start = idx; + return 0; + + list_window_center(lw, length, idx); /* make sure the cursor is in the window */ lw->selected = lw->start+offset; list_window_check_selected(lw, length); - lw->clear = 1; - lw->repaint = 1; - return 0; } |