Calculates the window's size, considering the various properties of its constituent panel.
The input parameters new-width and new-height specify the ``requested'' size for the window: if the current size is passed in, this function calculates what the window's size must be in order to completely display everything. If another size is passed in, this function returns the size, based on the inputs, which allows all of the window's contents to be visible.
The return values specify what the window's dimensions must be in order to satisfy the size requirements of the window's panel (width, then height). If one of the dimensions passed in satisfies the panel's requirements, it is left unchanged. If it is too small to display the entire panel, the smallest value which allows the full panel to be shown is returned. If it is larger than this smallest value and the panel is not stretchable in the corresponding direction, the smallest value is returned.
The width and the height of the window are handled independently of each other, so if the width is acceptable but the height is not, only the window's height will be changed.