Add boolean check before painting and remove minimum size from window.