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

RETURN VALUE

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

NOTES

102       Note that bkgdset and bkgd may be macros.
103
104       X/Open Curses mentions that the character part of the  background  must
105       be  a single-byte value.  This implementation, like SVr4, checks to en‐
106       sure that, and will reuse the old background  character  if  the  check
107       fails.
108

PORTABILITY

110       These  functions  are  described  in  the  XSI Curses standard, Issue 4
111       (X/Open Curses).
112

SEE ALSO

114       curses(3X), curs_addch(3X), curs_attr(3X), curs_outopts(3X)
115
116
117
118                                                                 curs_bkgd(3X)
Impressum