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:
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.
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 |
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 |
Returns and (with setf) sets the close-down mode of the client's resources at connection close.
|
kill-client | display resource-id | Function |
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 |
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 |
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. |