Jump to content
  • Advertisement
Sign in to follow this  
Dom_tucker

xlib - Hiding a hardware cursor

This topic is 4470 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!