C ++ - change cursor in window X

I thought it would be easy to find, but google search was very useless. Is there a simple api to change the mouse cursor in your X-window? (I know that in windows you can just call "SetCursor")

+4
source share
2 answers
#include <X11/cursorfont.h> /* ... */ Cursor c; c = XCreateFontCursor(dpy, XC_xterm); XDefineCursor(dpy, w, c); 

Where dpy is your display, w is your window, and XC_xterm is a constant that determines the shape of your cursor. Here is a list of available cursor shapes along with images.

+4
source

It seems like the equivalent of calling SetCursor XDefineCursor . You can get the Cursor identifier by calling XCreateFontCursor and passing one of the shapes from X11/cursorfont.h .

+2
source

All Articles