1curs_bkgd(3X) curs_bkgd(3X)
2
3
4
6 bkgdset, wbkgdset, bkgd, wbkgd, getbkgd - curses window background
7 manipulation routines
8
10 #include <curses.h>
11
12 void bkgdset(chtype ch);
13 void wbkgdset(WINDOW *win, chtype ch);
14 int bkgd(chtype ch);
15 int wbkgd(WINDOW *win, chtype ch);
16 chtype getbkgd(WINDOW *win);
17
19 bkgdset
20 The bkgdset and wbkgdset routines manipulate the background of the
21 named window. The window background is a chtype consisting of any com‐
22 bination of attributes (i.e., rendition) and a character. The
23 attribute part of the background is combined (OR'ed) with all non-blank
24 characters that are written into the window with waddch. Both the
25 character and attribute parts of the background are combined with the
26 blank characters. The background becomes a property of the character
27 and moves with the character through any scrolling and insert/delete
28 line/character operations.
29
30 To the extent possible on a particular terminal, the attribute part of
31 the background is displayed as the graphic rendition of the character
32 put on the screen.
33
34 bkgd
35 The bkgd and wbkgd functions set the background property of the current
36 or specified window and then apply this setting to every character
37 position in that window. According to X/Open Curses, it should do
38 this:
39
40 · The rendition of every character on the screen is changed to the
41 new background rendition.
42
43 · Wherever the former background character appears, it is changed to
44 the new background character.
45
46 Neither X/Open Curses nor the SVr4 manual pages give details about the
47 way the rendition of characters on the screen is updated when bkgd or
48 wbkgd is used to change the background character.
49
50 This implementation, like SVr4 curses, does not store the background
51 and window attribute contributions to each cell separately. It updates
52 the rendition by comparing the character, non-color attributes and col‐
53 ors contained in the background. For each cell in the window, whether
54 or not it is blank:
55
56 · The library first compares the character, and if it matches the
57 current character part of the background, it replaces that with the
58 new background character.
59
60 · The library then checks if the cell uses color, i.e., its color
61 pair value is nonzero. If not, it simply replaces the attributes
62 and color pair in the cell with those from the new background char‐
63 acter.
64
65 · If the cell uses color, and that matches the color in the current
66 background, the library removes attributes which may have come from
67 the current background and adds attributes from the new background.
68 It finishes by setting the cell to use the color from the new back‐
69 ground.
70
71 · If the cell uses color, and that does not match the color in the
72 current background, the library updates only the non-color
73 attributes, first removing those which may have come from the cur‐
74 rent background, and then adding attributes from the new back‐
75 ground.
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
81 attribute will be ignored.
82
83 getbkgd
84 The getbkgd function returns the given window's current background
85 character/attribute pair.
86
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
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
106 ensure that, and will reuse the old background character if the check
107 fails.
108
110 These functions are described in the XSI Curses standard, Issue 4
111 (X/Open Curses).
112
114 curses(3X), curs_addch(3X), curs_attr(3X), curs_outopts(3X)
115
116
117
118 curs_bkgd(3X)