Implemented the KEY_DOWN and KEY_UP events.