Setup listening for window events.