xref: /original-bsd/lib/libcurses/id_subwins.c (revision 0eaa7944)
1 # include	"curses.ext"
2 
3 /*
4  * _id_subwins:
5  *	Re-sync the pointers to _y for all the subwindows.
6  *
7  * @(#)id_subwins.c	1.1 (Berkeley) 05/01/85
8  */
9 _id_subwins(orig)
10 register WINDOW	*orig;
11 {
12 	register WINDOW	*win;
13 	register int	realy;
14 	register int	y, oy, x;
15 
16 	realy = orig->_begy + orig->_cury;
17 	for (win = orig->_nextp; win != orig; win = win->_nextp) {
18 		/*
19 		 * If the window ends before our current position,
20 		 * don't need to do anything.
21 		 */
22 		if (win->_begy + win->_maxy <= realy)
23 			continue;
24 
25 		oy = orig->_cury;
26 		for (y = realy - win->_begy; y < win->_maxy; y++, oy++)
27 			win->_y[y] = &orig->_y[oy][win->_ch_off];
28 	}
29 }
30