To raise a window so that no sibling window obscures it, use XRaiseWindow().
To lower a window so that it does not obscure any sibling windows, use XLowerWindow().
To circulate a subwindow up or down, use XCirculateSubwindows().
To raise the lowest mapped child of a window that is partially or completely occluded by another child, use XCirculateSubwindowsUp().
To lower the highest mapped child of a window that partially or completely occludes another child, use XCirculateSubwindowsDown().
To restack a set of windows from top to bottom, use XRestackWindows().