/* Compile: cc -lX11 -lXt xcursor xcursor.c */ #include #include #include int main(int argc, char *argv[]) { Display *dpy; Window junk1; unsigned int junk3; int x, y; int junk2; int r; XtToolkitInitialize(); dpy = XtOpenDisplay(XtCreateApplicationContext(), NULL, "xptr", "xptr", NULL, 0, &argc, argv); 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; }