the window should grow according to the number of instances to make sure they are visible, but the window should not waste space on the screen (since it is controlled by another application)