4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
40 #pragma ident "%Z%%M% %I% %E% SMI"
45 #include <sys/types.h>
46 #include "curses_inc.h"
48 /* Like refresh but does not output */
51 wnoutrefresh(WINDOW
*win
)
53 short *bch
, *ech
, *sbch
, *sech
;
54 chtype
**wcp
, **scp
, *wc
, *sc
;
56 short y
, x
, xorg
, yorg
, scrli
, scrco
,
57 boty
, sminy
, smaxy
, minx
, maxx
, lo
, hi
;
66 smaxy
= sminy
+ LINES
;
67 scrli
= curscr
->_maxy
;
68 scrco
= curscr
->_maxx
;
70 yorg
= win
->_begy
+ win
->_yoffset
;
73 /* save flags, cursor positions */
74 SP
->virt_scr
->_leave
= win
->_leave
;
75 if ((!win
->_leave
&& (win
->_flags
& (_WINCHANGED
| _WINMOVED
))) &&
76 ((y
= win
->_cury
+ yorg
) >= 0) && (y
< scrli
) &&
77 ((x
= win
->_curx
+ xorg
) >= 0) && (x
< scrco
)) {
82 _virtscr
->_use_idc
= FALSE
;
84 _virtscr
->_use_idl
= TRUE
;
86 _virtscr
->_clear
= TRUE
;
88 win
->_flags
|= _WINCHANGED
;
91 if (!(win
->_flags
& _WINCHANGED
))
94 /* region to update */
95 boty
= win
->_maxy
+yorg
;
96 if (yorg
>= sminy
&& yorg
< smaxy
&& boty
>= smaxy
)
104 if ((maxx
= win
->_maxx
+xorg
) > scrco
)
108 /* update structure */
113 hash
= _VIRTHASH
+ yorg
;
114 sbch
= _virtscr
->_firstch
+ yorg
;
115 sech
= _virtscr
->_lastch
+ yorg
;
116 scp
= _virtscr
->_y
+ yorg
;
118 /* first time around, set proper top/bottom changed lines */
124 /* update each line */
125 for (y
= 0; y
< boty
; ++y
, ++hash
, ++bch
, ++ech
, ++sbch
,
126 ++sech
, ++wcp
, ++scp
) {
127 if (!doall
&& *bch
== _INFINITY
)
130 lo
= (doall
|| *bch
== _REDRAW
|| *bch
< minx
) ? minx
: *bch
;
131 hi
= (doall
|| *bch
== _REDRAW
|| *ech
> maxx
) ? maxx
: *ech
;
135 /* adjust lo and hi so they contain whole characters */
137 if (ISCBIT(wc
[lo
])) {
138 for (x
= lo
- 1; x
>= minx
; --x
)
142 for (x
= lo
+1; x
<= maxx
; ++x
)
150 if (ISMBIT(wc
[hi
])) {
153 for (x
= hi
; x
>= lo
; --x
)
157 rb
= (unsigned char) RBYTE(wc
[x
]);
158 w
= _curs_scrwidth
[TYPE(rb
)];
159 hi
= (x
+w
) <= maxx
+1 ? x
+w
-1 : x
;
166 /* clear partial multi-chars about to be overwritten */
168 if (ISMBIT(sc
[lo
+ xorg
]))
169 (void) _mbclrch(_virtscr
, y
+ yorg
, lo
+ xorg
);
170 if (ISMBIT(sc
[hi
+ xorg
]))
171 (void) _mbclrch(_virtscr
, y
+ yorg
, hi
+ xorg
);
174 /* update the change structure */
175 if (*bch
== _REDRAW
|| *sbch
== _REDRAW
)
183 if ((y
+ yorg
) < _VIRTTOP
)
185 if ((y
+ yorg
) > _VIRTBOT
)
188 /* update the image */
190 sc
= *scp
+ lo
+ xorg
;
191 (void) memcpy((char *) sc
, (char *) wc
, (size_t)
192 (((hi
- lo
) + 1) * sizeof (chtype
)));
194 /* the hash value of the line */
203 _virtscr
->_flags
|= _WINCHANGED
;
204 win
->_flags
&= ~(_WINCHANGED
| _WINMOVED
| _WINSDEL
);