Working on X11 event loop