Hiding mouse cursor in X?

How can i hide the mouse cursor in X?
I have tried XDefineCursor(display, win, None); but that didn’t work :frowning:

It would be both easy and logical to use None as argument but the man page says “If the cursor is None, it is equivalent to XUndefineCursor”

Instead do you have to ceate a blank cursor . This is how glut does it:

/* X11 forces you to create a blank cursor if you want
to disable the cursor. */
static Cursor
makeBlankCursor(void)
{
static char data[1] =
{0};
Cursor cursor;
Pixmap blank;
XColor dummy;

blank = XCreateBitmapFromData(__glutDisplay, __glutRoot,
data, 1, 1);
if (blank == None)
__glutFatalError(“out of memory.”);
cursor = XCreatePixmapCursor(__glutDisplay, blank, blank,
&dummy, &dummy, 0, 0);
XFreePixmap(__glutDisplay, blank);

return cursor;
}

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.