summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ce87a1e)
raw | patch | inline | side by side (parent: ce87a1e)
author | Thomas Jansen <mithi@mithi.net> | |
Mon, 17 Aug 2009 10:19:37 +0000 (12:19 +0200) | ||
committer | Thomas Jansen <mithi@mithi.net> | |
Mon, 17 Aug 2009 10:19:37 +0000 (12:19 +0200) |
Volume changes that result in a shorter string length did not clean up the
now unused characters. We check the expected (relative) string length before
updating the screen and do a full repaint in that case.
now unused characters. We check the expected (relative) string length before
updating the screen and do a full repaint in that case.
src/screen.c | patch | blob | history |
diff --git a/src/screen.c b/src/screen.c
index 30a017d1edcdbb711ac48d66b9187f5673b0d176..1c44bf7e9cf991cf334e9d0f0d4f0d9dc69b7a9c 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
wnoutrefresh(w);
}
+static inline int
+volume_length(int volume)
+{
+ if (volume == 100)
+ return 3;
+ if (volume >= 10 && volume < 100)
+ return 2;
+ if (volume >= 0 && volume < 10)
+ return 1;
+ return -1;
+}
+
static void
paint_top_window(const char *header, mpdclient_t *c, int full_repaint)
{
full_repaint = 1;
}
+ if (c->status &&
+ volume_length(prev_volume) != volume_length(c->status->volume))
+ full_repaint = 1;
+
if (full_repaint) {
wmove(w, 0, 0);
wclrtoeol(w);