listen to window resize and repaint