CLX provides functions to destroy a window or destroy all children of a window. Note that by default, windows are destroyed when a connection is closed. For further information, See Closing the Display, and See Client Termination.
Destroys the specified window as well as all of its inferiors. The windows should never again be referenced. If the specified window is mapped, it is automatically unmapped. The window and all of its inferiors are then destroyed, and a :destroy-notify event is generated for each window. The ordering of the :destroy-notify events is such that for any given window being destroyed, :destroy-notify is generated on the window’s inferiors before being generated on the window. The ordering among siblings and across sub-hierarchies is not otherwise constrained. If the window is a root window, no windows are destroyed. Destroying a mapped window generates :exposure events on other windows that the mapped window obscured.
Destroys all inferiors of the specified window, in bottom to top stacking order. The X server generates a :destroy-notify event for each window. This is much more efficient than deleting many windows individually. The inferiors should never be referenced again.