source: trunk/minix/lib/curses/refresh.c@ 11

Last change on this file since 11 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.9 KB
RevLine 
[9]1/* refresh.c */
2
3#include <curses.h>
4#include "curspriv.h"
5
6/* Wrefresh() updates window win's area of the physical screen. */
7void wrefresh(win)
8WINDOW *win;
9{
10 if (win == curscr)
11 curscr->_clear = TRUE;
12 else
13 wnoutrefresh(win);
14 doupdate();
15}
16
17/****************************************************************/
18/* Wnoutrefresh() updates the image of the desired screen, */
19/* Without doing physical update (copies window win's image to */
20/* The _cursvar.tmpwin window, which is hidden from the user). */
21/****************************************************************/
22
23void wnoutrefresh(win)
24register WINDOW *win;
25{
26 register int *dst; /* start destination in temp window */
27 register int *end; /* end destination in temp window */
28 register int *src; /* source in user window */
29 register int first; /* first changed char on line */
30 register int last; /* last changed char on line */
31 WINDOW *nscr;
32 int begy; /* window's place on screen */
33 int begx;
34 int i;
35 int j;
36
37 nscr = _cursvar.tmpwin;
38 begy = win->_begy;
39 begx = win->_begx;
40
41 for (i = 0, j = begy; i <= win->_maxy; i++, j++) {
42 if (win->_minchng[i] != _NO_CHANGE) {
43 first = win->_minchng[i];
44 last = win->_maxchng[i];
45 dst = &(nscr->_line[j][begx + first]);
46 end = &(nscr->_line[j][begx + last]);
47 src = &(win->_line[i][first]);
48
49 while (dst <= end) /* copy user line to temp window */
50 *dst++ = *src++;
51
52 first += begx; /* nscr's min/max change positions */
53 last += begx;
54
55 if ((nscr->_minchng[j] == _NO_CHANGE) || (nscr->_minchng[j] > first))
56 nscr->_minchng[j] = first;
57 if (last > nscr->_maxchng[j]) nscr->_maxchng[j] = last;
58
59 win->_minchng[i] = _NO_CHANGE; /* updated now */
60 } /* if */
61 win->_maxchng[i] = _NO_CHANGE; /* updated now */
62 } /* for */
63
64 if (win->_clear) {
65 win->_clear = FALSE;
66 nscr->_clear = TRUE;
67 } /* if */
68 if (!win->_leave) {
69 nscr->_cury = win->_cury + begy;
70 nscr->_curx = win->_curx + begx;
71 } /* if */
72} /* wnoutrefresh */
Note: See TracBrowser for help on using the repository browser.