Handling the X event.