xref: /original-bsd/lib/libcurses/id_subwins.c (revision 860e07fc)
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.6 (Berkeley) 08/23/92";
10 #endif	/* not lint */
11 
12 #include <curses.h>
13 
14 /*
15  * __id_subwins --
16  *	Re-sync the pointers to _y for all the subwindows.
17  */
18 void
19 __id_subwins(orig)
20 	register WINDOW *orig;
21 {
22 	register WINDOW *win;
23 	register int oy, realy, y;
24 
25 	realy = orig->_begy + orig->_cury;
26 	for (win = orig->_nextp; win != orig; win = win->_nextp) {
27 		/*
28 		 * If the window ends before our current position, don't need
29 		 * to do anything.
30 		 */
31 		if (win->_begy + win->_maxy <= realy)
32 			continue;
33 
34 		oy = orig->_cury;
35 		for (y = realy - win->_begy; y < win->_maxy; y++, oy++)
36 			win->_y[y] = &orig->_y[oy][win->_ch_off];
37 	}
38 }
39