Sign in to follow this  

xlib - Hiding a hardware cursor

Recommended Posts

Hi Everyone, I am using the below function to hide the cursor. The problem is that the function has no effect. Other than I may have done something stupid here, the only thing I can think of is that I have a hardware cursor provided by my Nvidia drivers. Function to hide a cursor:
void hide_cursor(void)
char bm[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
Pixmap pix = XCreateBitmapFromData(dpy, win, data, 1, 1);
XColor black;
memset(&black, 0, sizeof(XColor));
black.flags = DoRed | DoGreen | DoBlue;
pointer = XCreatePixmapCursor(dpy, pix, pix, &black, &black, 0, 0);
XFreePixmap(dpy, pix);

XDefineCursor(dpy, win, pointer);
XSync(dpy, False); /* again, optional */

Calling event:
Screen *screen;
dpy = XOpenDisplay(":0.0");
screen = XScreenOfDisplay(dpy, 0);
win = screen->root;
//Hide cursor

Any thoughts as to why this cursor is still visible?

Share this post

Link to post
Share on other sites
I have tried the above code (see previous post) with both software and hardware cursors. The cursor is always visible.

I've designed an app using xlib and I have created crosshairs to replace the standard cursor. The problem is that the cursor appears in the middle of crosshairs.

Does anyone know of any other way to disable the cursor that will function with xlib?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this