2 /***************************************************************************
4 ****************************************************************************
5 * ncurses is copyright (C) 1992-1995 *
7 * zmbenhal@netcom.com *
9 * esr@snark.thyrsus.com *
11 * Permission is hereby granted to reproduce and distribute ncurses *
12 * by any means and for any fee, whether alone or as part of a *
13 * larger distribution, in source or in binary form, PROVIDED *
14 * this notice is included with any such distribution, and is not *
15 * removed from any of its header files. Mention of ncurses in any *
16 * applications linked with it is highly appreciated. *
18 * ncurses comes AS IS with no warranty, implied or expressed. *
20 ***************************************************************************/
22 #include <curses.priv.h>
24 MODULE_ID("$Id: lib_bkgd.c,v 1.7 1997/04/12 17:44:37 tom Exp $")
26 int wbkgd(WINDOW *win, const chtype ch)
29 chtype old_bkgd = getbkgd(win);
32 T((T_CALLED("wbkgd(%p,%s)"), win, _tracechtype(new_bkgd)));
34 if (TextOf(new_bkgd) == 0)
36 wbkgdset(win, new_bkgd);
37 wattrset(win, AttrOf(new_bkgd));
39 for (y = 0; y <= win->_maxy; y++) {
40 for (x = 0; x <= win->_maxx; x++) {
41 if (win->_line[y].text[x] == old_bkgd)
42 win->_line[y].text[x] = new_bkgd;
44 win->_line[y].text[x] =
45 TextOf(win->_line[y].text[x])