PDA

View Full Version : Hiding mouse cursor in X?



04-23-2002, 01:27 AM
How can i hide the mouse cursor in X?
I have tried XDefineCursor(display, win, None); but that didn't work :-(

04-23-2002, 05:17 AM
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;
}