diff options
author | Max Kellermann <max@duempel.org> | 2008-09-25 17:42:30 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-25 17:42:30 +0200 |
commit | dea63513303a45a231c71958b1e2a392fbf12033 (patch) | |
tree | 2a75b083c061719956b3dad163b007ee084c8ab7 /src/screen_lyrics.c | |
parent | 3e738fd1f8836442ccd525d0058766b3034164d4 (diff) | |
download | mpd-dea63513303a45a231c71958b1e2a392fbf12033.tar.gz mpd-dea63513303a45a231c71958b1e2a392fbf12033.tar.xz mpd-dea63513303a45a231c71958b1e2a392fbf12033.zip |
screen_lyrics: added lyrics_repaint()
lyrics_repaint() or lyrics_repaint_if_active() are called after data
has changed, and the screen needs an update.
Diffstat (limited to '')
-rw-r--r-- | src/screen_lyrics.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index 931b114fb..a039c3859 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -82,8 +82,31 @@ screen_lyrics_clear(void) g_ptr_array_set_size(current.lines, 0); } -static const char * -list_callback(unsigned idx, int *highlight, void *data); +static void +lyrics_paint(mpdclient_t *c); + +/** + * Repaint and update the screen. + */ +static void +lyrics_repaint(void) +{ + lyrics_paint(NULL); + wrefresh(lw->w); +} + +/** + * Repaint and update the screen, if it is currently active. + */ +static void +lyrics_repaint_if_active(void) +{ + if (get_cur_mode_id() == 104) { /* XXX don't use the literal number */ + lyrics_repaint(); + + /* XXX repaint the screen title */ + } +} static void screen_lyrics_set(const GString *str) @@ -125,12 +148,7 @@ screen_lyrics_set(const GString *str) /* paint new data */ - if (get_cur_mode_id() == 104) { /* XXX don't use the literal number */ - list_window_paint(lw, list_callback, NULL); - wrefresh(lw->w); - - /* XXX repaint the screen title */ - } + lyrics_repaint_if_active(); } static void @@ -297,8 +315,7 @@ lyrics_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) case CMD_LYRICS_UPDATE: if (c->song != NULL) { screen_lyrics_load(c->song); - lyrics_paint(NULL); - wrefresh(lw->w); + lyrics_repaint(); } return 1; default: |