Don't call set_window too often