xref: /csrg-svn/usr.bin/window/wwmisc.c (revision 33514)
118727Sedward /*
2*33514Sbostic  * Copyright (c) 1983 Regents of the University of California.
3*33514Sbostic  * All rights reserved.
4*33514Sbostic  *
5*33514Sbostic  * Redistribution and use in source and binary forms are permitted
6*33514Sbostic  * provided that this notice is preserved and that due credit is given
7*33514Sbostic  * to the University of California at Berkeley. The name of the University
8*33514Sbostic  * may not be used to endorse or promote products derived from this
9*33514Sbostic  * software without specific prior written permission. This software
10*33514Sbostic  * is provided ``as is'' without express or implied warranty.
1118727Sedward  */
1218727Sedward 
13*33514Sbostic #ifndef lint
14*33514Sbostic static char sccsid[] = "@(#)wwmisc.c	3.11 (Berkeley) 02/21/88";
15*33514Sbostic #endif /* not lint */
16*33514Sbostic 
1713926Sedward #include "ww.h"
1816322Sedward #include "tt.h"
1916322Sedward #include "char.h"
2013926Sedward 
2114896Sedward /*
2214986Sedward  * Sufficient but not necessary test for total visibility.
2314896Sedward  */
2414896Sedward wwvisible(w)
2514896Sedward register struct ww *w;
2614896Sedward {
2714896Sedward 	register i;
2814896Sedward 	register nvis = 0;
2914896Sedward 
3014986Sedward 	for (i = w->ww_i.t; i < w->ww_i.b; i++)
3114896Sedward 		nvis += w->ww_nvis[i];
3214986Sedward 	if (w->ww_hascursor
3315656Sedward 	    && w->ww_cur.r >= w->ww_i.t && w->ww_cur.r < w->ww_i.b
3414986Sedward 	    && w->ww_cur.c >= w->ww_i.l && w->ww_cur.c < w->ww_i.r
3514986Sedward 	    && wwsmap[w->ww_cur.r][w->ww_cur.c] == w->ww_index)
3614896Sedward 		nvis++;
3714986Sedward 	return nvis == w->ww_i.nr * w->ww_i.nc;
3814896Sedward }
3916322Sedward 
4016322Sedward wwbell()
4116322Sedward {
4233248Sbostic 	ttputc(ctrl('g'));
4316322Sedward }
44