8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libeti / panel / common / top.c
blob929daeb16a987c0957c7a974d07bf105a59b8b14
1 /*
2 * CDDL HEADER START
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
7 * with the License.
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]
20 * CDDL HEADER END
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--Move a panel to the top */
33 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
35 /*LINTLIBRARY*/
37 #include <sys/types.h>
38 #include <curses.h>
39 #include "private.h"
41 /* top_panel */
42 int
43 top_panel(PANEL *panel)
45 _obscured_list *obs;
46 _obscured_list *prev_obs, *tmp;
48 if (!panel || panel == panel -> below)
49 return (ERR);
51 /* If the panel is already on top, there is nothing to do */
53 if (_Top_panel == panel)
54 return (OK);
57 * All the panels that used to obscure this panel are
58 * now obscured by this panel.
61 if ((obs = panel -> obscured) != 0) {
62 do {
63 prev_obs = obs;
64 obs = obs -> next;
65 if ((tmp = prev_obs -> panel_p -> obscured) != 0) {
66 prev_obs->next = tmp->next;
67 tmp->next = prev_obs;
68 } else
69 prev_obs->next =
70 prev_obs->panel_p->obscured = prev_obs;
71 prev_obs -> panel_p = panel;
73 while (obs != panel -> obscured);
74 panel -> obscured = 0;
77 /* Move the panel to the top */
79 if (panel == _Bottom_panel)
80 (_Bottom_panel = panel -> above) -> below = 0;
81 else {
82 panel -> above -> below = panel -> below;
83 panel -> below -> above = panel -> above;
86 panel -> above = 0;
87 panel -> below = _Top_panel;
88 _Top_panel = _Top_panel -> above = panel;
89 (void) touchwin(panel -> win);
91 return (OK);