summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ba18555)
raw | patch | inline | side by side (parent: ba18555)
author | Max Kellermann <max.kellermann@gmail.com> | |
Mon, 20 Mar 2017 11:53:39 +0000 (12:53 +0100) | ||
committer | Max Kellermann <max.kellermann@gmail.com> | |
Mon, 20 Mar 2017 11:53:39 +0000 (12:53 +0100) |
src/screen.c | patch | blob | history |
diff --git a/src/screen.c b/src/screen.c
index 9ea6f9183e93c4472b828b977b108867758a0fc7..1646282ac053aa6046be5c88459ca751c8204c6b 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
mode_fn->open(c);
}
-void
-screen_paint(struct mpdclient *c)
+static void
+screen_refresh(struct mpdclient *c, bool main_dirty)
{
- const char *title = NULL;
-
- if (mode_fn->get_title != NULL)
- title = mode_fn->get_title(screen.buf, screen.buf_size);
-
- /* paint the title/header window */
- if( title )
- paint_top_window(title, c);
- else
- paint_top_window("", c);
+ /* update title/header window */
+ const char *title =
+#ifndef NCMPC_MINI
+ screen.welcome_source_id == 0 &&
+#endif
+ mode_fn->get_title != NULL
+ ? mode_fn->get_title(screen.buf, screen.buf_size)
+ : "";
+ assert(title != NULL);
+ paint_top_window(title, c);
/* paint the bottom window */
/* paint the main window */
- wclear(screen.main_window.w);
- if (mode_fn->paint != NULL)
- mode_fn->paint();
+ if (main_dirty) {
+ wclear(screen.main_window.w);
+ if (mode_fn->paint != NULL)
+ mode_fn->paint();
+ }
/* move the cursor to the origin */
doupdate();
}
+void
+screen_paint(struct mpdclient *c)
+{
+ screen_refresh(c, true);
+}
+
void
screen_update(struct mpdclient *c)
{
mpdclient_is_connected(c))
screen_status_printf(_("Database updated"));
was_connected = mpdclient_is_connected(c);
-
- /* update title/header window */
- if (screen.welcome_source_id != 0)
- paint_top_window("", c);
- else
#endif
- if (mode_fn->get_title != NULL) {
- paint_top_window(mode_fn->get_title(screen.buf,screen.buf_size), c);
- } else
- paint_top_window("", c);
-
- /* update progress window */
- update_progress_window(c, false);
-
- /* update status window */
- status_bar_paint(&screen.status_bar, c->status, c->song);
/* update the main window */
if (mode_fn->update != NULL)
mode_fn->update(c);
- /* move the cursor to the origin */
-
- if (!options.hardware_cursor)
- wmove(screen.main_window.w, 0, 0);
-
- wnoutrefresh(screen.main_window.w);
-
- /* tell curses to update */
- doupdate();
+ screen_refresh(c, false);
}
#ifdef HAVE_GETMOUSE