X-Git-Url: https://git.danieliu.xyz/?p=smdp.git;a=blobdiff_plain;f=src%2Fviewer.c;h=925efb14e9702f92a29d54f0c38be3a3390bb5ed;hp=d106a6221929a56e98a0d6da5d711d49c91726ef;hb=848c4a361effd594b47c90ea5e14d4b620393212;hpb=f49286fb39ff984f8fdbae7a890445a3e921aebb diff --git a/src/viewer.c b/src/viewer.c index d106a62..925efb1 100644 --- a/src/viewer.c +++ b/src/viewer.c @@ -229,12 +229,14 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reloa colors = 1; } - // set background color of main window + // set background color for main window if(colors) - wbkgd(stdscr, COLOR_PAIR(CP_YELLOW)); + wbkgd(stdscr, COLOR_PAIR(CP_WHITE)); - // setup main window + // setup content window WINDOW *content = newwin(LINES - bar_top - bar_bottom, COLS, 0 + bar_top, 0); + + // set background color of content window if(colors) wbkgd(content, COLOR_PAIR(CP_WHITE)); @@ -261,6 +263,10 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reloa // always resize window in case terminal geometry has changed wresize(content, LINES - bar_top - bar_bottom, COLS); + // set main window text color + if(colors) + wattron(stdscr, COLOR_PAIR(CP_YELLOW)); + // setup header if(bar_top) { line = deck->header; @@ -304,9 +310,8 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reloa break; } - // make header + fooder visible - wrefresh(content); - wrefresh(stdscr); + // copy changed lines in main window to virtual screen + wnoutrefresh(stdscr); line = slide->line; l = stop = 0; @@ -339,8 +344,11 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reloa } } - // make content visible - wrefresh(content); + // copy changed lines in content window to virtual screen + wnoutrefresh(content); + + // compare virtual screen to physical screen and does the actual updates + doupdate(); // fade in if(fade) @@ -863,8 +871,11 @@ void fade_out(WINDOW *window, int trans, int colors, int invert) { init_pair(CP_BLACK, 16, white_ramp[i]); } - // refresh window with new color - wrefresh(window); + // refresh virtual screen with new color + wnoutrefresh(window); + + // compare virtual screen to physical screen and does the actual updates + doupdate(); // delay for our eyes to recognize the change usleep(FADE_DELAY); @@ -890,8 +901,11 @@ void fade_in(WINDOW *window, int trans, int colors, int invert) { init_pair(CP_BLACK, 16, white_ramp[i]); } - // refresh window with new color - wrefresh(window); + // refresh virtual screen with new color + wnoutrefresh(window); + + // compare virtual screen to physical screen and does the actual updates + doupdate(); // delay for our eyes to recognize the change usleep(FADE_DELAY);