Page:Xlib - C Language X Interface.pdf/40

This page needs to be proofread.
Attribute Default InputOutput InputOnly


backing-store NotUseful Yes No
backing-planes Allones Yes No
backing-pixel zero Yes No
save-under False Yes No
event-mask emptyset Yes Yes
do-not-propagate-mask emptyset Yes Yes
override-redirect False Yes Yes
colormap CopyFromParent Yes No
cursor None Yes Yes

3.2.1. Background Attribute

Only InputOutput windows can have a background. You can set the background of an InputOutput window by using a pixel or a pixmap.

The background-pixmap attribute of a window specifies the pixmap to be used for a window's background. This pixmap can be of any size, although some sizes may be faster than others. The background-pixel attribute of a window specifies a pixel value used to paint a window's background in a single color.

You can set the background-pixmap to a pixmap, None (default), or ParentRelative. You can set the background-pixel of a window to any pixel value (no default). If you specify a background-pixel, it overrides either the default background-pixmap or any value you may have set in the background-pixmap. A pixmap of an undefined size that is filled with the background-pixel is used for the background. Range checking is not performed on the background pixel; it simply is truncated to the appropriate number of bits.

If you set the background-pixmap, it overrides the default. The background-pixmap and the window must have the same depth, or a BadMatch error results. If you set background-pixmap to None, the window has no defined background. If you set the background-pixmap to ParentRelative:

  • The parent window's background-pixmap is used. The child window, however, must have the same depth as its parent, or a BadMatch error results.
  • If the parent window has a background-pixmap of None, the window also has a background-pixmap of None.
  • Acopy of the parent window's background-pixmap is not made. The parent's background-pixmap is examined each time the child window's background-pixmap is required.
  • The background tile origin always aligns with the parent window's background tile origin. If the background-pixmap is not ParentRelative, the background tile origin is the child window's origin.

Setting a new background, whether by setting background-pixmap or background-pixel, overrides any previous background. The background-pixmap can be freed immediately if no further explicit reference is made to it (the X server will keep a copy to use when needed). If you later draw into the pixmap used for the background, what happens is undefined because the X implementation is free to make a copy of the pixmap or to use the same pixmap.

When no valid contents are available for regions of a window and either the regions are visible or the server is maintaining backing store, the server automatically tiles the regions with the window's background unless the window has a background of None. If the background is None, the

35