summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLev Lamberov <dogsleg@debian.org>2016-04-05 16:35:20 +0500
committerLev Lamberov <dogsleg@debian.org>2016-04-05 16:35:20 +0500
commitaac8429e891ade0cd3e42034a739c583747ef5a7 (patch)
tree288cede768ba0f343312844608ff09df9546ee78
parente5ebc58df833143384cc2b20e3b46c01c2510812 (diff)
Imported Upstream version 1.0.6
-rw-r--r--include/main.h2
-rw-r--r--src/viewer.c41
2 files changed, 29 insertions, 14 deletions
diff --git a/include/main.h b/include/main.h
index edf4679..047d2fc 100644
--- a/include/main.h
+++ b/include/main.h
@@ -25,6 +25,6 @@
#define MDP_VER_MAJOR 1
#define MDP_VER_MINOR 0
-#define MDP_VER_REVISION 5
+#define MDP_VER_REVISION 6
#endif // !defined( MAIN_H )
diff --git a/src/viewer.c b/src/viewer.c
index c23dc40..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)
@@ -520,7 +528,8 @@ void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colo
// fill rest off line with spaces if we are in a code block
if(CHECK_BIT(line->bits, IS_CODE) && colors) {
- wattron(window, COLOR_PAIR(CP_BLACK));
+ if(colors)
+ wattron(window, COLOR_PAIR(CP_BLACK));
for(i = getcurx(window) - x; i < max_cols; i++)
wprintw(window, "%s", " ");
}
@@ -862,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);
@@ -889,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);