xref: /original-bsd/lib/libcurses/id_subwins.c (revision d15729d4)
1 /*
2  * Copyright (c) 1981 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)id_subwins.c	5.4 (Berkeley) 06/01/90";
10 #endif /* not lint */
11 
12 # include	"curses.ext"
13 
14 /*
15  * _id_subwins:
16  *	Re-sync the pointers to _y for all the subwindows.
17  *
18  */
19 _id_subwins(orig)
20 register WINDOW	*orig;
21 {
22 	register WINDOW	*win;
23 	register int	realy;
24 	register int	y, oy, x;
25 
26 	realy = orig->_begy + orig->_cury;
27 	for (win = orig->_nextp; win != orig; win = win->_nextp) {
28 		/*
29 		 * If the window ends before our current position,
30 		 * don't need to do anything.
31 		 */
32 		if (win->_begy + win->_maxy <= realy)
33 			continue;
34 
35 		oy = orig->_cury;
36 		for (y = realy - win->_begy; y < win->_maxy; y++, oy++)
37 			win->_y[y] = &orig->_y[oy][win->_ch_off];
38 	}
39 }
40