keyboard control fix

Fixed the bug that allowed the pad to get off the screen when using
keyboard controls.