Prevents the cursor from leaving the screen.