Listener for Window events.