xref: /original-bsd/lib/libcurses/id_subwins.c (revision 730930d2)
1 /*
2  * Copyright (c) 1981, 1993, 1994
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)id_subwins.c	8.2 (Berkeley) 05/04/94";
10 #endif	/* not lint */
11 
12 #include "curses.h"
13 
14 /*
15  * __id_subwins --
16  *	Re-sync the pointers to lines 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->lines[y]->line =
37 				&orig->lines[oy]->line[win->ch_off];
38 	}
39 }
40