summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8173e34)
raw | patch | inline | side by side (parent: 8173e34)
author | Max Kellermann <max@duempel.org> | |
Mon, 28 Sep 2009 16:21:54 +0000 (18:21 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Mon, 28 Sep 2009 16:21:54 +0000 (18:21 +0200) |
When the "scroll" option is active, ncmpc repainted the whole screen
with each tick, even if the selected item is not wider than the
screen. This wasted a lot of CPU cycles.
with each tick, even if the selected item is not wider than the
screen. This wasted a lot of CPU cycles.
src/screen_play.c | patch | blob | history |
diff --git a/src/screen_play.c b/src/screen_play.c
index fb5e82b1d3dddad4f48471dcc8e819a636bda7a9..ed17499164d0f5bca8a4636e5372129127ab4d8d 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
GList **dir_list;
struct mpdclient *c;
} completion_callback_data_t;
+
+static bool must_scroll;
#endif
static struct mpdclient_playlist *playlist;
@@ -141,6 +143,8 @@ list_callback(unsigned idx, bool *highlight, char **second_column, G_GNUC_UNUSED
static unsigned current_song;
char *tmp;
+ must_scroll = true;
+
if (current_song != lw->selected) {
st.offset = 0;
current_song = lw->selected;
static void
play_paint(void)
{
+#ifndef NCMPC_MINI
+ must_scroll = false;
+#endif
+
list_window_paint(lw, list_callback, NULL);
}
playlist_repaint();
#ifndef NCMPC_MINI
- } else if (options.scroll) {
+ } else if (options.scroll && must_scroll) {
/* always repaint if horizontal scrolling is
enabled */
playlist_repaint();