Jump to content
  • Advertisement
Sign in to follow this  
doutmost

Anyone knows how to hide/show mouse pointer under linux using opengl?

This topic is 5047 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

Advertisement
In windows it's done with a windows call, not a gl one. Shouldn't there be a x function call for that?

Share this post


Link to post
Share on other sites
so anyone knows the function for that? it doesnot matter opengl or linux. I got one for windows. it is showcursor, but didnot find the function for linux.

Share this post


Link to post
Share on other sites
I just want to hide cursor when I run a little game, but I can move cursor to operate a paddle. I will try the function you gave here, thanks.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Well you're not going to be able to hide the cursor on a system-wide level... so it's just for your window. Since there's no show/hide functions for cursors in xlib (if that's what you're using) ... then I'd imagine you have to create a new cursor 0x0 and replace your current cursor with it, then swap them when you want your cursor to be visible again.

Share this post


Link to post
Share on other sites
/* vars to make blank cursor */
Pixmap blank;
XColor dummy;
char data[1] = {0};
Cursor cursor;

/* make a blank cursor */
blank = XCreateBitmapFromData (dpy, win, data, 1, 1);
if(blank == None) fprintf(stderr, "error: out of memory.\n");
cursor = XCreatePixmapCursor(dpy, blank, blank, &dummy, &dummy, 0, 0);
XFreePixmap (dpy, blank);


this makes you the cursor. then set it using this function
XDefineCursor(Display *display, Window w, Cursor cursor);


after you do not need the cursor anymore use this function. it will undo the last change done by XDefineCursor (thus do only use ONCE XDefineCursor and then XUndefineCursor):
XUndefineCursor(Display *display, Window w);


hope this helps.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!