Reputation: 7051
I noticed, that using XCreateFontCursor and then XDefineCursor with cursor code XC_watch (150) actually sets the cursor not to the ugly Xlib cursor, but to the default system animated hourglass cursor.
For me this indicates that some system (the window manager?) intercepts the xlib calls and changes the cursors transparently.
But how I can set this way the cursor to the "arrow+hourglass" cursor, if it is not defined in XLib constants?
Upvotes: 3
Views: 1718
Reputation: 54455
What you're looking for is called cursor themes (which extend the X cursor font stuff, not always in a compatible manner). For some discussion:
That's the user-level (where you can see animated cursors). The Xcursor library is used by the X server to override the older bitmap-cursor behavior to provide colors and other interesting image-related features. The documentation is ... poor, essentially requiring other developers to get most of the information by reading source-code (as I did in xterm — look for "XCursor").
Here's a pointer to the source-code:
http://cgit.freedesktop.org/xorg/lib/libXcursor/
Upvotes: 1
Reputation: 33193
There is a mapping from cursor shape definitions (numbers) to images provided by a cursor theme. This appears to be handled by Xcursor. Looking at the Xcursor.h file has this note:
/* * This is the function called by Xlib when attempting to * load cursors from XCreateGlyphCursor. The interface must * not change as Xlib loads 'libXcursor.so' instead of * a specific major version */
which suggests that the XcursorTryShapeCursor
function is involved in translating the call to XCreateFontCursor
into an image file to be loaded.
So the icon files that are used to satisfy the Xlib calls are managed by an icon theme that is provided by Xcursor. XcursorSetTheme
can be used to select an alternative cursor theme but unless the original ugly X11 cursors have been installed as a theme you can't get the built-in ones that way.
However, the Xcursor manual mentions the XCURSOR_PATH
environment variable. If this is set to a path that has no cursor themes then everything defaults to the built-in ugly cursors. eg: env XCURSOR_PATH=/tmp ./test_application
Upvotes: 1