Next Prev Up

14.5 Client Termination

The CLX functions affecting client termination are discussed in the following paragraphs.

When a display connection to an X server is closed, whether by an explicit call to close-display or by some external condition, the server automatically performs a sequence of operations to clean up server state information associated with the closed connection. The effect of these operations depends the close-down mode and the save-set that the client has specified for the closed display connection. The close-down mode of a display determines whether server resources allocated by the connection are freed or not. The save-set identifies windows that will remain after the connection is closed.

The display save-set is used primarily by window managers that reparent the top-level windows of other clients. For example, such a window manager can automatically create a frame window that encloses a top-level client window, along with a set of controls used for window management. Ordinarily, termination of the window manager client would then destroy all client windows! However, the window manager can prevent this by adding to its save-set those windows created by other clients that should be preserved.

When a display connection closes, an X server performs the following operations:

  1. For each selection owned by a window created on the connection, the selection owner is set to nil.
  2. An active or passive grab established for a window created on the connection is released.
  3. If the connection has grabbed the server, the server is ungrabbed.
  4. Server resources and colormap cells allocated by the connection are freed and destroyed, depending on the close-down mode, as follows:

When server resources allocated by a display connection are destroyed -- whether by closing the connection with close-down mode :destroy or by later calling kill-client or kill-temporary-clients -- then an X server performs the following operations on each member of the save-set before actually destroying resources.

  1. If the save-set window is a descendant of a window created on the connection, the save-set window is reparented. The new parent is the closest ancestor such that the save-set window is no longer a descendant of any window created on the connection. The position of the reparented window with respect to its parent remains unchanged.
  2. If the save-set window is unmapped, then it is mapped.

If the last connection open to an X server is closed with close-down mode :destroy, the server resets its state to restore all initial defaults. The server state after reset is the same as its initial state when first started. When an X server resets, it performs the following operations:

The following paragraphs describe the CLX functions used to:


add-to-save-set window Function
     
window
A window.

Adds the specified window to the save-set of the window display. The window must have been created by some other display. Windows are removed automatically from the save-set when they are destroyed.


close-down-mode display Function
     
display
A display.

Returns and (with setf) sets the close-down mode of the client's resources at connection close.

mode
One of :destroy, :retain-permanent, or :retain-temporary.

kill-client display resource-id Function
     
display
A display.
resource-id
A valid card29 resource ID.

Closes the display connection which created the given resource-id. The resource-id must be valid, but need not belong to the given display.

If the closed connection was previously open, the connection is closed according to its close-down mode. Otherwise, if the connection had been previously terminated with close-down mode :retain-permanent or :retain-temporary, then all its retained server resources -- both permanent and temporary -- are destroyed.


kill-temporary-clients display Function
     
display
A display.

Closes the display connection and destroys all retained temporary server resources for this and all previously-terminated connections.

If the display connection was previously open, the connection is closed according to its close-down mode. Otherwise, if the display connection had been previously terminated with close-down mode :retain-permanent or :retain-temporary, then all its retained server resources -- both permanent and temporary -- are destroyed.


remove-from-save-set window Function
     
window
A window.

Removes the specified window from the save-set of the window display. The window must have been created by some other display. Windows are removed automatically from the save-set when they are destroyed.


Next Prev Up
© 1988, 1989 Texas Instruments Incorporated
Conversion to HTML made by Gilbert Baumann.
Last build: Tue Dec 16 23:30:42 1997