メインコンテンツまでスキップ

Requests: Window Creation and Attributes

CreateWindow​

wid, parent: WINDOW
class: {InputOutput, InputOnly, CopyFromParent}
depth: CARD8
visual: VISUALID or CopyFromParent
x, y: INT16
width, height, border-width: CARD16
value-mask: BITMASK
value-list: LISTofVALUE
Errors: IDChoice, Window, Pixmap, Colormap, Cursor, Match,

Value, Alloc Creates an unmapped window, and assigns the identifier wid to it.

A class of CopyFromParent means the class is taken from the parent. A depth of zero for class InputOutput or CopyFromParent means the depth is taken from the parent. A visual of CopyFromParent means the visual type is taken from the parent. For class InputOutput, the visual type and depth must be a combination supported for the screen (else a Match error); the depth need not be the same as the parent, but the parent must not be of class InputOnly (else a Match error). For class InputOnly, the depth must be zero (else a Match error), and the visual must be one supported for the screen (else a Match error), but the parent may have any depth and class.

The server essentially acts as if InputOnly windows do not exist for the purposes of graphics requests, exposure processing, and VisibilityNotify events. An InputOnly window cannot be used as a drawable (as a source or destination for graphics requests). InputOnly and InputOutput windows act identically in other respects (properties, grabs, input control, and so on).

The window is placed on top in the stacking order with respect to siblings. The x and y coordinates are relative to the parent's origin, and specify the position of the upper left outer corner of the window (not the origin). The width and height specify the inside size, not including the border, and must be non-zero. The border-width for an InputOnly window must be zero (else a Match error).

The value-mask and value-list specify attributes of the window that are to be explicitly initialized. The possible values are:

background-pixmap: PIXMAP or None or ParentRelative
background-pixel: CARD32
border-pixmap: PIXMAP or CopyFromParent
border-pixel: CARD32
bit-gravity: BITGRAVITY
win-gravity: WINGRAVITY
backing-store: {NotUseful, WhenMapped, Always}
backing-bit-planes: CARD32
backing-pixel: CARD32
save-under: BOOL
event-mask: SETofEVENT
do-not-propagate-mask: SETofDEVICEEVENT
override-redirect: BOOL
colormap: COLORMAP or CopyFromParent
cursor: CURSOR or None

The default values, when attributes are not explicitly initialized, are:

background-pixmap: None
border-pixmap: CopyFromParent
bit-gravity: Forget
win-gravity: NorthWest
backing-store: NotUseful
backing-bit-planes: all ones
backing-pixel: zero
save-under: False
event-mask: {} (empty set)
do-not-propagate-mask: {} (empty set)
override-redirect: False
colormap: CopyFromParent
cursor: None

Only the following attributes are defined for InputOnly

windows: win-gravity, event-mask, do-not-propagate-mask,

and cursor. It is a Match error to specify any other attributes for InputOnly windows.

If background-pixmap is given, it overrides the default background-pixel. The background pixmap and the window must have the same root and the same depth (else a Match error). Any size pixmap can be used, although some sizes may be faster than others. If background None is specifed, the window has no defined background. If background ParentRelative is specified, the parent's background is used, but the window must have the same depth as the parent (else a Match error); if the parent has background None, then the window will also have background None. A copy of the parent's background is not made; the parent's background is reexamined each time the window background is required. If background-pixel is given, it overrides the default and any background-pixmap given, and a pixmap of undefined size filled with background-pixel is used for the background. For a ParentRelative background, the background tile origin always aligns with the parent's background tile origin; otherwise the background tile origin is always the window origin.

When regions of the window are exposed and the server has not retained the contents, the server automatically tiles the regions with the window's background unless the window has a background of None, in which case the previous screen contents are simply left in place. Exposure events are then generated for the regions, even if the background is None.

The border tile origin is always the same as the background tile origin. If border-pixmap is given, it overrides the default border-pixel. The border pixmap and the window must have the same root and the same depth (else a Match error). Any size pixmap can be used, although some sizes may faster than others. If CopyFromParent is given, the parent's border pixmap is copied (subsequent changes to the parent do not affect the child), but the window must have the same depth as the parent (else a Match error). If border-pixel is given, it overrides the default and any border-pixmap given, and a pixmap of undefined size filled with border-pixel is used for the border.

Output to a window is always clipped to the inside of the window, so that the border is never affected.

The bit-gravity defines which region of the window should be retained if the window is resized, and win-gravity defines how the window should be repositioned if the parent is resized; see ConfigureWindow.

A backing-store of WhenMapped advises the server that maintaining contents of obscured regions when the window is mapped would be beneficial. A backing-store of Always advises the server that maintaining contents even when the window is unmapped would be beneficial. Note that, even if the window is larger than its parent, the server should maintain complete contents, not just the region within the parent boundaries. If the server maintains contents, Exposure events will not be generated, but the server may stop maintaining contents at any time. A value of NotUseful advises the server that maintaining contents is unnecessary, although a server may still choose to maintain contents.

Backing-bit-planes indicates (with one bits) which bit planes of the window hold dynamic data that must be preserved in backing-stores. Backing-pixel specifies what value to use in planes not covered by backing-bit-planes. The server is free to only save the specified bit planes in the backing-store, and regenerate the remaining planes with the specified pixel value.

If save-under is True, the server is advised that, when this window is mapped, saving the contents of windows it obscures would be beneficial.

The event-mask defines which events the client is interested in for this window (or, for some event types, inferiors of the window). The do-not-propagate-mask defines which events should not be propagated to ancestor windows when no client has the event type selected in this window.

Override-redirect specifies whether map and configure request on this window should override a SubstructureRedirect on the parent, typically to inform a window manager not to tamper with the window.

The colormap specifies the colormap, that best reflects the "true" colors of the window. Servers capable of supporting hardware colormaps may use this information, and window managers may use it for InstallColormap requests. The colormap must have the same visual type as the window (else a match error). If CopyFromParent is specified, the parents's colormap is copied (subsequent changes to the parent do not affect the child), but the window must have the same visual type as the parent (else a Match error) an the parent must not have a colormap of None (else a Match error).

If a cursor is specified, it will be used whenever the pointer is in the window. If None is specified, the parent's cursor will be used when the pointer is in the window, and any change in the parent's cursor will cause an immediate change in the display cursor.

This request generates a CreateNotify event.

The background and border pixmaps and the cursor may be freed immediately if no further explicit references to them are to be made.

Subsequent drawing into the background or border pixmap has an undefined effect on the window state; the server might or might not make a copy of the pixmap.

ChangeWindowAttributes​

window: WINDOW
value-mask: BITMASK
value-list: LISTofVALUE
Errors: Window, Pixmap, Colormap, Cursor, Match, Value,
Access

The value-mask and value-list specify which attributes are to be changed. The values and restrictions are the same as for CreateWindow.

Changing the background does not cause the window contents to be changed. Setting the border, or changing the background such that border tile origin changes, causes the border to be repainted. Changing the background of a root window to None or ParentRelative restores the default background pixmap. Changing the border of a root window to CopyFromParent restores the default border pixmap.

Changing the back-store of an obsecured window to WhenMapped or Always, or changing the backing-bit-planes, backing-pixel, or save-under of a mapped window, may have no immediate effect.

Multiple clients can select input on the same window; their event-masks are disjoint. When an event is generated it will be reported to all interested clients. However, at most one client at a time can select for SubstructureRedirect, at most one client at a time can select for ResizeRedirectr, and at most one client at a time can select for ButtonPress.

There is only one do-not-propagate-mask for a window, not one per client.

Changing the colormap of a window (i.e., defining a new map, not changing the contents of the existing map) generates a ColormapNorify event. Changing the colormap os a visible window may have no immediate effect on the screen; see InstallColormap.

Changing the cursor of a root window to None restores the default cursor.

The order in which attributes are verified and altered is server dependent. If an error is generated, a subset of the attributes may have been altered.

GetWindowAttributes​

window: WINDOW

=>

visual: VISUALID
class: {InputOutput, InputOnly}
bit-gravity: BITGRAVITY
win-gravity: WINGRAVITY
backing-store: {NotUseful, WhenMapped, Always}
backing-bit-planes: CARD32
backing-pixel: CARD32
save-under: BOOL
colormap: COLORMAP or None
map-is-installed: BOOL
map-state: {Unmapped, Unviewable, Viewable}
all-event-masks, your-event-mask: SETofEVENT
do-not-propagate-mask: SETofDEVICEEVENT
override-redirect: BOOL
Errors: Window

Returns current attributes of the window. All-event-masks is the inclusive-OR of all event masks selected on the window by clients. Your-event-mask is the event mask selected by the querying client.

DestroyWindow​

window: WINDOW
Errors: Window

If the argument window is mapped, an UnmapWindow request is performed automatically. The window and all inferiors are then destroyed, and a DestroyNotify event is generated for each window, in order from the argument window downwards, with unspecified order among siblings at each level.

Normal exposure processing on formerly obscured windows is performed.

If the window is a root window, this request has no effect.

DestroySubwindows​

window: WINDOW
Errors: Window

Performs a DestroyWindow on all children of the window, in bottom to top stacking order.

ChangeSaveSet​

window: WINDOW
mode: {Insert, Delete}
Errors: Window, Match, Value

Adds or removes the specified window from the client's "save-set". The window must have been created by some other client (else a Match error). The use of the save-set is described in Section 11.

Windows are removed automatically from the save-set by the server when they are destroyed.