Next: , Previous: , Up: Windows and Pixmaps   [Contents][Index]

5.5 Window Hierarchy

All the windows in X are arranged in a strict hierarchy. At the top of the hierarchy are the root windows, which cover the display screens. Each root window is partially or completely covered by its child windows. All windows, except for root windows, have parents. Child windows can have their own children. In this way, a tree of arbitrary depth on each screen can be created. CLX provides several functions for examining and modifying the window hierarchy.

Function: drawable-root drawable

A drawable.

Returns the root window of the specified drawable.


Type window.

Function: query-tree window &key (:result-type `list)

A window.


A valid type specifier for a sub-type of sequence. The default is a list.

Returns the children windows, the parent window, and the root window for the specified window. The children are returned as a sequence of windows in current stacking order, from bottom-most (first) to top-most (last). The :result-type specifies the type of children sequence returned.


Type sequence of window.


Type window or null.


Type window.

Function: reparent-window window parent x y

A window.


The new parent window.


The position (type int16) of the window in its new parent. These coordinates are relative to the parent’s origin, and specify the new position of the upper, left, outer corner of the window.

Changes a window’s parent within a single screen. There is no way to move a window between screens.

The specified window is reparented by inserting it as a child of the specified parent. If the window is mapped, an unmap-window operation is automatically performed on the specified window. The window is then removed from its current position in the hierarchy and inserted as the child of the specified parent. The window is placed on top in the stacking order with respect to sibling windows.

After reparenting the specified window, a :reparent-notify event is generated. The override-redirect attribute of the window is passed on in this event. Window manager clients normally should ignore this event if this attribute is :on. See Events and Input, for more information on :reparent-notify event processing. Finally, if the specified window was originally mapped, a map-window operation is automatically performed on it.

The X server performs normal exposure processing on formerly obscured windows. It might not generate :exposure events for regions from the initial unmap-window operation if they are immediately obscured by the final map-window operation.

It is an error if any of the following are true:

Function: translate-coordinates source source-x source-y destination

A window defining the source coordinate system.


Coordinates (int16) relative to the origin of the source window.


A window defining the destination coordinate system.

Returns the position defined by source-x and source-y (relative to the origin of the source window), expressed as coordinates (two int16 values) relative to the origin of the destination window.


Type int16 or null.


Type int16 or null.


Type window or null.

Next: , Previous: , Up: Windows and Pixmaps   [Contents][Index]