Fix window gain focus problem when animating window.