xcb_wait_for_event and core event handling