>>> I need to get the current mouse cursor/pointer being displayed by
>>> the X server in a window but there doesn't seem to be an obvious way
>>> to do it in Xlib. XDefineCursor() sets it but there doesn't appear
>>> to be a way to get it.
and later added:
> [XQueryPointer] doesn't return the glyph or bitmap currently being
> used for the pointer itself.
I'm not seeing any standard way of retrieving that.
XSetWindowAttributes (and several X*Grab* functions) can set the cursor,
but XGetWindowAttributes doesn't return it.
About the only thing I found by `grep Cursor *.h */*.h` from X11 was
./extensions/Xfixes.h: XFixesGetCursorImage (Display *dpy);
which (I assume) only works when that extension is supported. To the
extent you want the cursor attribute of a particular window, though,
rather than (as its name suggests) the value of the cursor for the whole
display at that instant (when the pointer might not be in the window
you're interested in), the value might not be what you're seeking.
For an individual application, you could put "wrappers" around every
call that sets the Cursor, to save the value before doing the X
That's about all I found.