Automatic hdoze window sizing