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

{| cellspacing=0
 * width=160px style="border-bottom:solid 1px black; border-top:solid 1px black;" | Gravity Direction
 * width=140px style="border-bottom:solid 1px black; border-top:solid 1px black;" | Coordinates
 * NorthEastGravity || (Width, 0)
 * WestGravity || (0, Height/2)
 * CenterGravity || (Width/2, Height/2)
 * EastGravity || (Width, Height/2)
 * SouthWestGravity || (0, Height)
 * SouthGravity || (Width/2, Height)
 * style="border-bottom:solid 1px black;" | SouthEastGravity || style="border-bottom:solid 1px black;" | (Width, Height)
 * }
 * SouthWestGravity || (0, Height)
 * SouthGravity || (Width/2, Height)
 * style="border-bottom:solid 1px black;" | SouthEastGravity || style="border-bottom:solid 1px black;" | (Width, Height)
 * }
 * style="border-bottom:solid 1px black;" | SouthEastGravity || style="border-bottom:solid 1px black;" | (Width, Height)
 * }
 * }

When a window with one of these bit-gravity values is resized, the corresponding pair defines the change in position of each pixel in the window. When a window with one of these win-gravities has its parent window resized, the corresponding pair defines the change in position of the window within the parent. When a window is so repositioned, a GravityNotify event is generated (see section 10.10.5).

A bit-gravity of StaticGravity indicates that the contents or origin should not move relative to the origin of the root window. If the change in size of the window is coupled with a change in position (x, y), then for bit-gravity the change in position of each pixel is (­x, ­y), and for wingravity the change in position of a child when its parent is so resized is (­x, ­y). Note that StaticGravity still only takes effect when the width or height of the window is changed, not when the window is moved.

A bit-gravity of ForgetGravity indicates that the window's contents are always discarded after a size change, even if a backing store or save under has been requested. The window is tiled with its background and zero or more Expose events are generated. If no background is defined, the existing screen contents are not altered. Some X servers may also ignore the specified bit-gravity and always generate Expose events.

The contents and borders of inferiors are not affected by their parent's bit-gravity. A server is permitted to ignore the specified bit-gravity and use Forget instead.

A win-gravity of UnmapGravity is like NorthWestGravity (the window is not moved), except the child is also unmapped when the parent is resized, and an UnmapNotify event is generated.

 3.2.4. Backing Store Attribute 

Some implementations of the X server may choose to maintain the contents of InputOutput windows. If the X server maintains the contents of a window, the off-screen saved pixels are known as backing store. The backing store advises the X server on what to do with the contents of a window. The backing-store attribute can be set to NotUseful (default), WhenMapped, or Always.

A backing-store attribute of NotUseful advises the X server that maintaining contents is unnecessary, although some X implementations may still choose to maintain contents and, therefore, not generate Expose events. A backing-store attribute of WhenMapped advises the X server that maintaining contents of obscured regions when the window is mapped would be beneficial. In this case, the server may generate an Expose event when the window is created. A backing-store attribute of Always advises the X server that maintaining contents even when the window is unmapped would be beneficial. Even if the window is larger than its parent, this is a request to the X server to maintain complete contents, not just the region within the parent window boundaries.

While the X server maintains the window's contents, Expose events normally are not generated, but the X server may stop maintaining contents at any time.

When the contents of obscured regions of a window are being maintained, regions obscured by noninferior windows are included in the destination of graphics requests (and source, when the window is the source). However, regions obscured by inferior windows are not included.