Don't do this in MainLoop but in InputEvent.