/* Compile: cc -lX11 xcursor xcursor.c */ #include #include int main(int argc, char *argv[]) { Display *dpy; Window junk1; unsigned int junk3; int x, y; int junk2; int r; dpy = XOpenDisplay(0); if (XQueryPointer(dpy, DefaultRootWindow(dpy), &junk1, &junk1, &x, &y, &junk2, &junk2, &junk3) != 0) { printf("%d %d\n", x, y); r = 0; } else r = 1; XCloseDisplay(dpy); return r; }