private void dispatch_event () {
    event = display.next_event ();
    if ((event_mask & EVENT_BIT) != 0 && handle_event (event)) return;

    switch (event.code ()) {
    case ButtonPress.CODE: dispatch_button_press (); break;
    case ClientMessage.CODE: dispatch_client_message (); break;
    case ConfigureNotify.CODE: dispatch_configure_notify (); break;
    case Expose.CODE: dispatch_expose (); break;	
    case KeyPress.CODE: dispatch_key_press (); break;
    case MotionNotify.CODE: dispatch_motion_notify (); break;
    }
  }