lib_slkclear.c revision 176187
1146515Sru/****************************************************************************
2146515Sru * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
3146515Sru *                                                                          *
493139Sru * Permission is hereby granted, free of charge, to any person obtaining a  *
5114472Sru * copy of this software and associated documentation files (the            *
6146515Sru * "Software"), to deal in the Software without restriction, including      *
793139Sru * without limitation the rights to use, copy, modify, merge, publish,      *
8114472Sru * distribute, distribute with modifications, sublicense, and/or sell       *
9114472Sru * copies of the Software, and to permit persons to whom the Software is    *
10114472Sru * furnished to do so, subject to the following conditions:                 *
1193139Sru *                                                                          *
12114472Sru * The above copyright notice and this permission notice shall be included  *
1321495Sjmacd * in all copies or substantial portions of the Software.                   *
14114472Sru *                                                                          *
15114472Sru * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16114472Sru * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17114472Sru * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18114472Sru * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19114472Sru * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20114472Sru * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21114472Sru * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
2256160Sru *                                                                          *
23114472Sru * Except as contained in this notice, the name(s) of the above copyright   *
24114472Sru * holders shall not be used in advertising or otherwise to promote the     *
25114472Sru * sale, use or other dealings in this Software without prior written       *
2693139Sru * authorization.                                                           *
27114472Sru ****************************************************************************/
28114472Sru
2921495Sjmacd/****************************************************************************
30114472Sru *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
31114472Sru *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
32114472Sru *     and: Juergen Pfeifer                         1996-1999               *
3393139Sru *     and: Thomas E. Dickey                        1996-on                 *
3493139Sru ****************************************************************************/
3556160Sru
3656160Sru/*
37114472Sru *	lib_slkclear.c
3856160Sru *	Soft key routines.
3921495Sjmacd *      Remove soft labels from the screen.
4056160Sru */
4156160Sru#include <curses.priv.h>
4256160Sru
4356160SruMODULE_ID("$Id: lib_slkclear.c,v 1.10 2007/12/29 17:51:47 tom Exp $")
4493139Sru
45114472SruNCURSES_EXPORT(int)
46114472Sruslk_clear(void)
4756160Sru{
48114472Sru    int rc = ERR;
49114472Sru
50114472Sru    T((T_CALLED("slk_clear()")));
51114472Sru
52114472Sru    if (SP != NULL && SP->_slk != NULL) {
5356160Sru	SP->_slk->hidden = TRUE;
5456160Sru	/* For simulated SLK's it looks much more natural to
5521495Sjmacd	   inherit those attributes from the standard screen */
56114472Sru	SP->_slk->win->_nc_bkgd = stdscr->_nc_bkgd;
5756160Sru	WINDOW_ATTRS(SP->_slk->win) = WINDOW_ATTRS(stdscr);
58114472Sru	if (SP->_slk->win == stdscr) {
5956160Sru	    rc = OK;
6042660Smarkm	} else {
6142660Smarkm	    werase(SP->_slk->win);
6242660Smarkm	    rc = wrefresh(SP->_slk->win);
6321495Sjmacd	}
64114472Sru    }
6556160Sru    returnCode(rc);
6656160Sru}
6756160Sru