xref: /original-bsd/usr.bin/window/wwmisc.c (revision 648cab2a)
1 /*
2  * Copyright (c) 1983 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that this notice is preserved and that due credit is given
7  * to the University of California at Berkeley. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  */
12 
13 #ifndef lint
14 static char sccsid[] = "@(#)wwmisc.c	3.11 (Berkeley) 02/21/88";
15 #endif /* not lint */
16 
17 #include "ww.h"
18 #include "tt.h"
19 #include "char.h"
20 
21 /*
22  * Sufficient but not necessary test for total visibility.
23  */
24 wwvisible(w)
25 register struct ww *w;
26 {
27 	register i;
28 	register nvis = 0;
29 
30 	for (i = w->ww_i.t; i < w->ww_i.b; i++)
31 		nvis += w->ww_nvis[i];
32 	if (w->ww_hascursor
33 	    && w->ww_cur.r >= w->ww_i.t && w->ww_cur.r < w->ww_i.b
34 	    && w->ww_cur.c >= w->ww_i.l && w->ww_cur.c < w->ww_i.r
35 	    && wwsmap[w->ww_cur.r][w->ww_cur.c] == w->ww_index)
36 		nvis++;
37 	return nvis == w->ww_i.nr * w->ww_i.nc;
38 }
39 
40 wwbell()
41 {
42 	ttputc(ctrl('g'));
43 }
44