Protect the Xlib calls with #ifdef X11 (how can this ever be false?)