xref: /original-bsd/usr.bin/window/wwmisc.c (revision 900dc424)
1 /*
2  * Copyright (c) 1983, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Edward Wang at The University of California, Berkeley.
7  *
8  * %sccs.include.redist.c%
9  */
10 
11 #ifndef lint
12 static char sccsid[] = "@(#)wwmisc.c	8.1 (Berkeley) 06/06/93";
13 #endif /* not lint */
14 
15 #include "ww.h"
16 #include "tt.h"
17 #include "char.h"
18 
19 /*
20  * Sufficient but not necessary test for total visibility.
21  */
22 wwvisible(w)
23 register struct ww *w;
24 {
25 	register i;
26 	register nvis = 0;
27 
28 	for (i = w->ww_i.t; i < w->ww_i.b; i++)
29 		nvis += w->ww_nvis[i];
30 	if (w->ww_hascursor
31 	    && w->ww_cur.r >= w->ww_i.t && w->ww_cur.r < w->ww_i.b
32 	    && w->ww_cur.c >= w->ww_i.l && w->ww_cur.c < w->ww_i.r
33 	    && wwsmap[w->ww_cur.r][w->ww_cur.c] == w->ww_index)
34 		nvis++;
35 	return nvis == w->ww_i.nr * w->ww_i.nc;
36 }
37 
38 wwbell()
39 {
40 	ttputc(ctrl('g'));
41 }
42