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"
44 #include <sys/types.h>
46 #include "curses_inc.h"
49 * Pad refresh. These routines are provided for upward compatibility
50 * with the 'pad' structure of Sys V.2. Since windows now can be of
51 * arbitrary size and derived windows can be moved within their
52 * parent windows effortlessly, a separate notion of 'pad' as
53 * a larger-than-screen window is no longer necessary.
55 * pminy, pminx: the area (pminy, pminx, maxy, maxx) of pad is refreshed
56 * sminy, sminx, smaxy, smaxx: the screen area to be affected.
60 prefresh(WINDOW
*pad
, int pminy
, int pminx
, int sminy
,
61 int sminx
, int smaxy
, int smaxx
)
63 return (_prefresh(wrefresh
, pad
, pminy
, pminx
, sminy
,
64 sminx
, smaxy
, smaxx
));
68 _prefresh(int (*func
)(WINDOW
*), WINDOW
*pad
, int pminy
, int pminx
,
69 int sminy
, int sminx
, int smaxy
, int smaxx
)
73 * If pad->_padwin doesn't exist(meaning that this is
74 * the first call to p*refresh) create it as a derived window
78 if ((pad
->_padwin
= derwin(pad
, pad
->_maxy
, pad
->_maxx
,
82 /* else pad->_padwin->_use_idl = TRUE; */
85 * The following makes parent window to run in fast mode
86 * by creating an illusion that it has no derived windows
92 if (_padjust(pad
, pminy
, pminx
, sminy
, sminx
, smaxy
, smaxx
) == ERR
)
96 (*func
)(pad
->_padwin
);
101 _padjust(WINDOW
*pad
, int pminy
, int pminx
, int sminy
,
102 int sminx
, int smaxy
, int smaxx
)
104 short prows
, pcols
, y
;
105 WINDOW
*padwin
= pad
->_padwin
;
108 /* make sure the area requested to be updated is on the pad */
110 if ((pminy
>= pad
->_maxy
) || (pminx
>= pad
->_maxx
))
113 /* determine the area of the pad to be updated */
120 /* determine the screen area affected */
132 * Modify the area of the pad to be updated taking into
133 * consideration screen parameters.
136 if ((prows
= (smaxy
- sminy
) + 1) > (y
= pad
->_maxy
- pminy
))
138 if ((pcols
= (smaxx
- sminx
) + 1) > (y
= pad
->_maxx
- pminx
))
141 if (((padwin
->_cury
= pad
->_cury
- pminy
) < 0) ||
142 (padwin
->_cury
>= prows
))
144 if (((padwin
->_curx
= pad
->_curx
- pminx
) < 0) ||
145 (padwin
->_curx
>= pcols
))
148 padwin
->_leave
= pad
->_leave
;
149 padwin
->_use_idl
= pad
->_use_idl
;
153 * If padwin refers to the same derwin, return. Otherwise
154 * update the coordinates and malloc'ed areas of the padwin
157 if ((padwin
->_begy
== sminy
) && (padwin
->_begx
== sminx
) &&
158 (padwin
->_maxy
== prows
) && (padwin
->_maxx
== pcols
) &&
159 (padwin
->_y
[0] == (pad
->_y
[pminy
] + pminx
)) &&
160 (!(pad
->_flags
& _WINSDEL
))) {
164 /* update the coordinates of the pad */
166 padwin
->_maxy
= prows
;
167 padwin
->_maxx
= pcols
;
169 padwin
->_begy
= (short)sminy
;
171 padwin
->_begx
= (short)sminx
;
173 padwin
->_pary
= (short)pminy
;
175 padwin
->_parx
= (short)pminx
;
177 /* update the malloc'ed areas */
182 for (y
= 0; y
< prows
; y
++, pminy
++)
183 p_y
[y
] = o_y
[pminy
] + pminx
;
185 (void) wtouchln(padwin
, 0, prows
, TRUE
);