Expanding on what the above wrote, there's an option in the game (system settings?) to say lock mouse to screen, you probably want to check that, then it won't be able to leave the application.