1curs_bkgd(3X)                                                    curs_bkgd(3X)
2
3
4

NAME

6       bkgdset,  wbkgdset, bkgd, wbkgd, getbkgd - curses window background ma‐
7       nipulation routines
8

SYNOPSIS

10       #include <curses.h>
11
12       void bkgdset(chtype ch);
13       void wbkgdset(WINDOW *win, chtype ch);
14
15       int bkgd(chtype ch);
16       int wbkgd(WINDOW *win, chtype ch);
17
18       chtype getbkgd(WINDOW *win);
19

DESCRIPTION

21   bkgdset
22       The bkgdset and wbkgdset routines set the background for a  window.   A
23       window's  background  is  a chtype consisting of any combination of at‐
24       tributes (i.e., rendition) and a character:
25
26       •   The attribute part of the background is combined (OR'ed)  with  all
27           non-blank characters that are written into the window with waddch.
28
29       •   Both  the  character and attribute parts of the background are com‐
30           bined with blank characters that are written into the window.
31
32       The background becomes a property of each character and moves with  the
33       character through any scrolling and insert/delete line/character opera‐
34       tions.
35
36       To the extent possible on a particular terminal, the attribute part  of
37       the  background  is displayed as the graphic rendition of the character
38       put on the screen.
39
40   bkgd
41       The bkgd and wbkgd functions set the background property of the current
42       or  specified window and then apply this setting to every character po‐
43       sition in that window.  According to X/Open Curses, it should do this:
44
45       •   The rendition of every character on the screen is  changed  to  the
46           new background rendition.
47
48       •   Wherever  the former background character appears, it is changed to
49           the new background character.
50
51       Neither X/Open Curses nor the SVr4 manual pages give details about  the
52       way  the  rendition of characters on the screen is updated when bkgd or
53       wbkgd is used to change the background character.
54
55       This implementation, like SVr4 curses, does not  store  the  background
56       and window attribute contributions to each cell separately.  It updates
57       the rendition by comparing the character, non-color attributes and col‐
58       ors  contained in the background.  For each cell in the window, whether
59       or not it is blank:
60
61       •   The library first compares the character, and  if  it  matches  the
62           current character part of the background, it replaces that with the
63           new background character.
64
65           When bkgdset is used to set the background character, that does not
66           update  each  cell  in  the window.  A subsequent call to bkgd will
67           only modify the character in cells which match  the  current  back‐
68           ground character.
69
70       •   The  library  then  checks  if the cell uses color, i.e., its color
71           pair value is nonzero.  If not, it simply replaces  the  attributes
72           and color pair in the cell with those from the new background char‐
73           acter.
74
75       •   If the cell uses color, and that matches the color in  the  current
76           background, the library removes attributes which may have come from
77           the current background and adds attributes from the new background.
78           It finishes by setting the cell to use the color from the new back‐
79           ground.
80
81       •   If the cell uses color, and that does not match the  color  in  the
82           current  background,  the  library  updates  only the non-color at‐
83           tributes, first removing those which may have come from the current
84           background, and then adding attributes from the new background.
85
86       If the background's character value is zero (0), a space is assumed.
87
88       If  the  terminal  does  not  support  color,  or if color has not been
89       started with start_color, the new background character's  color  attri‐
90       bute will be ignored.
91
92   getbkgd
93       The  getbkgd  function  returns  the  given window's current background
94       character/attribute pair.
95

RETURN VALUE

97       These functions are described in the XSI Curses standard, Issue 4.   It
98       specifies that bkgd and wbkgd return ERR on failure, but gives no fail‐
99       ure conditions.
100
101       The routines bkgd and wbkgd return the integer OK, unless  the  library
102       has not been initialized.
103
104       In  contrast, the SVr4.0 manual says bkgd and wbkgd may return OK "or a
105       non-negative integer if immedok is set", which  refers  to  the  return
106       value  from wrefresh (used to implement the immediate repainting).  The
107       SVr4 curses wrefresh returns the number of characters  written  to  the
108       screen during the refresh.  This implementation does not do that.
109

NOTES

111       Note that bkgdset and bkgd may be macros.
112
113       X/Open  Curses  mentions that the character part of the background must
114       be a single-byte value.  This implementation, like SVr4, checks to  en‐
115       sure  that,  and  will  reuse the old background character if the check
116       fails.
117

PORTABILITY

119       These functions are described in  the  XSI  Curses  standard,  Issue  4
120       (X/Open Curses).
121

SEE ALSO

123       curses(3X), curs_addch(3X), curs_attr(3X), curs_outopts(3X)
124
125
126
127                                                                 curs_bkgd(3X)
Impressum