xref: /csrg-svn/lib/libcurses/touchwin.c (revision 55981)
122685Sdist /*
234677Sbostic  * Copyright (c) 1981 Regents of the University of California.
334677Sbostic  * All rights reserved.
434677Sbostic  *
542657Sbostic  * %sccs.include.redist.c%
622685Sdist  */
722685Sdist 
822685Sdist #ifndef lint
9*55981Sbostic static char sccsid[] = "@(#)touchwin.c	5.5 (Berkeley) 08/23/92";
1034677Sbostic #endif /* not lint */
1122685Sdist 
12*55981Sbostic #include <curses.h>
132265Sarnold 
142265Sarnold /*
15*55981Sbostic  * touchwin --
16*55981Sbostic  *	Make it look like the whole window has been changed.
172265Sarnold  */
18*55981Sbostic int
192265Sarnold touchwin(win)
20*55981Sbostic 	register WINDOW *win;
212265Sarnold {
22*55981Sbostic 	register int y, maxy;
2312341Sarnold 
24*55981Sbostic #ifdef DEBUG
25*55981Sbostic 	__TRACE("touchwin: (%0.2o)\n", win);
26*55981Sbostic #endif
2719898Sbloom 	maxy = win->_maxy;
2819898Sbloom 	for (y = 0; y < maxy; y++)
2919898Sbloom 		touchline(win, y, 0, win->_maxx - 1);
30*55981Sbostic 	return (OK);
3112341Sarnold }
3212341Sarnold 
3312341Sarnold /*
34*55981Sbostic  * touchline --
35*55981Sbostic  *	Touch a given line.
3612341Sarnold  */
37*55981Sbostic int
3819898Sbloom touchline(win, y, sx, ex)
39*55981Sbostic 	register WINDOW *win;
40*55981Sbostic 	register int y, sx, ex;
4119898Sbloom {
42*55981Sbostic #ifdef DEBUG
43*55981Sbostic 	__TRACE("touchline: (%0.2o, %d, %d, %d)\n", win, y, sx, ex);
44*55981Sbostic 	__TRACE("touchline: first = %d, last = %d\n",
45*55981Sbostic 	    win->_firstch[y], win->_lastch[y]);
46*55981Sbostic #endif
4719898Sbloom 	sx += win->_ch_off;
4819898Sbloom 	ex += win->_ch_off;
4919898Sbloom 	if (win->_firstch[y] == _NOCHANGE) {
5019898Sbloom 		win->_firstch[y] = sx;
5119898Sbloom 		win->_lastch[y] = ex;
52*55981Sbostic 	} else {
5319898Sbloom 		if (win->_firstch[y] > sx)
5419898Sbloom 			win->_firstch[y] = sx;
5519898Sbloom 		if (win->_lastch[y] < ex)
5619898Sbloom 			win->_lastch[y] = ex;
5719898Sbloom 	}
58*55981Sbostic #ifdef DEBUG
59*55981Sbostic 	__TRACE("touchline: first = %d, last = %d\n",
60*55981Sbostic 	    win->_firstch[y], win->_lastch[y]);
61*55981Sbostic #endif
62*55981Sbostic 	return (OK);
632265Sarnold }
64