Sign in to follow this  

xlib - Hiding a hardware cursor

This topic is 4278 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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

This topic is 4278 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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