From fbdac7f3219a03b45a3c141f1479565a1f22352f Mon Sep 17 00:00:00 2001 From: Mark Edgar Date: Tue, 8 Oct 2013 23:58:06 +0200 Subject: [PATCH 1/4] Call doupdate() immediately before select() to reduce screen updates and terminal output. --- dvtm.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/dvtm.c b/dvtm.c index bff057b..9f26d5b 100644 --- a/dvtm.c +++ b/dvtm.c @@ -251,7 +251,7 @@ drawbar() { attrset(NORMAL_ATTR); if (sel) curs_set(vt_cursor(sel->term)); - refresh(); + wnoutrefresh(stdscr); } static void @@ -295,7 +295,7 @@ static void draw(Client *c) { draw_content(c); draw_border(c); - wrefresh(c->window); + wnoutrefresh(c->window); } static void @@ -315,12 +315,11 @@ draw_all(bool border) { * this has the effect that the cursor position is * accurate */ - refresh(); if (sel) { draw_content(sel); if (border) draw_border(sel); - wrefresh(sel->window); + wnoutrefresh(sel->window); } } @@ -395,12 +394,12 @@ focus(Client *c) { settitle(c); if (tmp) { draw_border(tmp); - wrefresh(tmp->window); + wnoutrefresh(tmp->window); } if (isarrange(fullscreen)) redrawwin(c->window); draw_border(c); - wrefresh(c->window); + wnoutrefresh(c->window); } static void @@ -568,8 +567,6 @@ resize_screen() { resizeterm(screen.h, screen.w); wresize(stdscr, screen.h, screen.w); - wrefresh(curscr); - refresh(); waw = screen.w; wah = screen.h; @@ -676,7 +673,7 @@ destroy(Client *c) { sel = NULL; } werase(c->window); - wrefresh(c->window); + wnoutrefresh(c->window); vt_destroy(c->term); delwin(c->window); if (!clients && countof(actions)) { @@ -912,7 +909,6 @@ static void redraw(const char *args[]) { for (Client *c = clients; c; c = c->next) vt_dirty(c->term); - wrefresh(curscr); resize_screen(); draw_all(true); } @@ -1378,6 +1374,7 @@ main(int argc, char *argv[]) { nfds = max(nfds, c->pty); c = c->next; } + doupdate(); r = select(nfds + 1, &rd, NULL, NULL, NULL); if (r == -1 && errno == EINTR) @@ -1444,7 +1441,6 @@ main(int argc, char *argv[]) { draw_content(sel); wnoutrefresh(sel->window); } - doupdate(); } cleanup(); -- 1.8.4.1