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]
22 /* Copyright (c) 1988 AT&T */
23 /* All Rights Reserved */
27 * Copyright (c) 1997, by Sun Microsystems, Inc.
28 * All rights reserved.
31 /* A panels subsystem built on curses--Update the pile of panels */
33 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
37 #include <sys/types.h>
43 * touch_top - Touch the line in all windows
44 * which is visible above a given line
47 touch_top(PANEL
*panel
, int line
, _obscured_list
*obs
, int start_x
, int end_x
)
50 _obscured_list
*next_obs
;
54 if ((next_obs
= obs
->next
) == panel
-> obscured
-> next
)
57 if (line
>= obs
-> start
&& line
<= obs
-> end
&&
58 pnl
->wstartx
<= end_x
&& pnl
->wendx
>= start_x
) {
59 (void) touchline(pnl
->win
, line
- pnl
->wstarty
, 1);
60 if (pnl
->wstartx
> start_x
&& pnl
->wendx
< end_x
) {
62 touch_top(panel
, line
, next_obs
,
64 end_x
= pnl
-> wstartx
- 1;
66 if (pnl
->wstartx
<= start_x
)
67 start_x
= pnl
-> wendx
+ 1;
68 if (pnl
->wendx
>= end_x
)
69 end_x
= pnl
-> wstartx
- 1;
75 while ((obs
= next_obs
) != 0);
80 * Touch the line in all windows which is visible above a given line.
81 * This routine is almost identical to touch_top, except that the "panel"
82 * is stdscr in this case. The "obscured" list is the list of panels.
85 std_touch_top(int line
, PANEL
*obs_pnl
, int start_x
, int end_x
)
90 next_obs
= obs_pnl
-> below
;
92 if (line
>= obs_pnl
->wstarty
&& line
<= obs_pnl
->wendy
&&
93 obs_pnl
->wstartx
<= end_x
&& obs_pnl
->wendx
>= start_x
) {
94 (void) touchline(obs_pnl
->win
,
95 line
- obs_pnl
->wstarty
, 1);
96 if (obs_pnl
->wstartx
> start_x
&&
97 obs_pnl
->wendx
< end_x
) {
99 std_touch_top(line
, next_obs
,
100 obs_pnl
->wendx
+1, end_x
);
101 end_x
= obs_pnl
-> wstartx
- 1;
103 if (obs_pnl
->wstartx
<= start_x
)
104 start_x
= obs_pnl
-> wendx
+ 1;
105 if (obs_pnl
->wendx
>= end_x
)
106 end_x
= obs_pnl
-> wstartx
- 1;
112 while ((obs_pnl
= next_obs
) != 0);
115 /* touchup - Touch lines in obscuring panals as necessary */
117 touchup(PANEL
*panel
)
122 * for each line in the window which has been touched,
123 * touch lines in panals above it.
126 screen_y
= panel
->wendy
;
128 for (i
= panel
->wendy
- panel
->wstarty
; i
>= 0; screen_y
--, i
--) {
129 if (is_linetouched(panel
-> win
, i
) == TRUE
)
130 touch_top(panel
, screen_y
, panel
->obscured
->next
,
131 panel
->wstartx
, panel
->wendx
);
137 * Touch lines in obscuring panals as necessary. This routine is
138 * almost exactly like touchup, except that the "panel" is stdscr,
139 * and the obscured list is the list of panels.
147 * for each line in stdscr which has been touched,
148 * touch lines in panals above it.
151 for (screen_y
= LINES
- 1; screen_y
>= 0; screen_y
--) {
152 if (is_linetouched(stdscr
, screen_y
) == TRUE
)
153 std_touch_top(screen_y
, _Top_panel
, 0, COLS
- 1);
157 /* update_panels - Refresh the pile of panels */
164 * if stdscr has been touched, touch the visible lines
168 if (is_wintouched(stdscr
)) {
172 (void) wnoutrefresh(stdscr
);
176 * Refresh panals starting at the bottom of the pile.
177 * If a line in a window has been touched, touch all
178 * corresponding lines in the obscuring windows.
181 for (panel
= _Bottom_panel
; panel
; panel
= panel
-> above
) {
182 if (is_wintouched(panel
-> win
)) {
183 if (panel
-> obscured
)
185 (void) wnoutrefresh(panel
-> win
);