On Thu, Aug 27, 2009 at 1:46 AM, <[email protected]> wrote:
> Thanks for the application suggestions. how can I get the current cursor
> location from the CLI?
See attached file.
/* Compile: cc -lX11 -lXt xcursor xcursor.c */
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/Xlib.h>
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;
}