date and time created 85/05/01 18:17:37 by bloom
[unix-history] / usr / src / lib / libcurses / touchwin.c
CommitLineData
ce69801e
KA
1# include "curses.ext"
2
3/*
4 * make it look like the whole window has been changed.
5 *
ee79d1a2 6 * @(#)touchwin.c 1.3 (Berkeley) %G%
ce69801e
KA
7 */
8touchwin(win)
ee79d1a2 9register WINDOW *win;
ce69801e 10{
ee79d1a2 11 register int y, maxy;
60d72089 12
ee79d1a2
JB
13# ifdef DEBUG
14 fprintf(outf, "TOUCHWIN(%0.2o)\n", win);
15# endif
16 maxy = win->_maxy;
17 for (y = 0; y < maxy; y++)
18 touchline(win, y, 0, win->_maxx - 1);
60d72089
KA
19}
20
21/*
ee79d1a2 22 * touch a given line
60d72089 23 */
ee79d1a2
JB
24touchline(win, y, sx, ex)
25register WINDOW *win;
26register int y, sx, ex;
27{
28# ifdef DEBUG
29 fprintf(outf, "TOUCHLINE(%0.2o, %d, %d, %d)\n", win, y, sx, ex);
30 fprintf(outf, "TOUCHLINE:first = %d, last = %d\n", win->_firstch[y], win->_lastch[y]);
31# endif
32 sx += win->_ch_off;
33 ex += win->_ch_off;
34 if (win->_firstch[y] == _NOCHANGE) {
35 win->_firstch[y] = sx;
36 win->_lastch[y] = ex;
37 }
38 else {
39 if (win->_firstch[y] > sx)
40 win->_firstch[y] = sx;
41 if (win->_lastch[y] < ex)
42 win->_lastch[y] = ex;
ce69801e 43 }
ee79d1a2
JB
44# ifdef DEBUG
45 fprintf(outf, "TOUCHLINE:first = %d, last = %d\n", win->_firstch[y], win->_lastch[y]);
46# endif
ce69801e 47}