Process key events.