public SharedXConnection() { //Using a standard loop of XNextEvent was causing unpredictable issues, //instead we poll the X server for events every few MS. (TODO - poll properly) XInitThreads(); XDisplay = XOpenDisplay(0); if (XDisplay == IntPtr.Zero) { throw new XLibException("Failed to connect to X"); } XRootWindow = XDefaultRootWindow(XDisplay); errorHandler = HandleError; ioErrorHandler = HandleIOError; XSetErrorHandler(errorHandler); XSetIOErrorHandler(ioErrorHandler); new Task(() => EventLoop()).Start(); }
public static extern int XSetIOErrorHandler(X11IOErrorDelegate handler);