All X Toolkit applications should terminate by calling XtDestroyApplicationContext and then exiting using the standard method for their operating system (typically, by calling exit for POSIX-based systems). The quickest way to make the windows disappear while exiting is to call XtUnmapWidget on each top- level shell widget. The Intrinsics have no resources beyond those in the program image, and the X server will free its resources when its connection to the application is broken.
Depending upon the widget set in use, it may be necessary to explicitly destroy individual widgets or widget trees with XtDestroyWidget before calling XtDestroyApplicationContext in order to ensure that any required widget cleanup is properly executed. The application developer must refer to the widget documentation to learn if a widget needs to perform additional cleanup beyond that performed automatically by the operating system. None of the widget classes defined by the Intrinsics require additional cleanup.
A widget does not directly control its size and location; rather, its parent is responsible for controlling them. Although the position of children is usually left up to their parent, the widgets themselves often have the best idea of their optimal sizes and, possibly, preferred locations.
To resolve physical layout conflicts between sibling widgets and between a widget and its parent, the Intrinsics provide the geometry management mechanism. Almost all composite widgets have a geometry manager specified in the geometry_manager field in the widget class record that is responsible for the size, position, and stacking order of the widget's children. The only exception is fixed boxes, which create their children themselves and can ensure that their children will never make a geometry request.