Jump to content
  • Advertisement
Sign in to follow this  
knobby67

Turning off mouse pointer in linux GLX examples

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

I've asked this a few places but don't seem to be able to get an answer, can anyone tell me how to turn off the mouse pointer when the GLX examples go full screen. Thanks

Share this post


Link to post
Share on other sites
Advertisement
You can use this :


void setVisible(bool visible)
{
if(!visible)
{
char data[] = {0};
Cursor cursor;
Pixmap blank;
XColor dummy;
blank = XCreateBitmapFromData(dpy, win, data, 1, 1);
cursor = XCreatePixmapCursor(dpy, blank, blank, &dummy, &dummy, 0, 0);
XDefineCursor(dpy, win, cursor);
XFreePixmap(dpy, blank);
XFreeCursor(dpy, cursor);
}
else
XUndefineCursor(dpy, win);
}

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Thanks for that bannanajoe but I've got a few problems I hope you could explain.

I've made a few changes so it works with the nehe exaples ie put the screen stuff in a structure (GLWin) so I have

if(!visible)
{
char data[] = {0};
Cursor cursor;
Pixmap blank;
XColor dummy;
blank = XCreateBitmapFromData(GLWin.dpy, GLWin.win, data, 1, 1);
cursor = XCreatePixmapCursor(GLWin.dpy, blank, blank, &dummy, &dummy, 0, 0);
XDefineCursor(GLWin.dpy, GLWin.win, cursor);
XFreePixmap(GLWin.dpy, blank);
XFreeCursor(GLWin.dpy, cursor);
}

else
XUndefineCursor(GLWin.dpy, GLWin.win);

When I compile then run I get bad window. If I comment out the else bit it will run. However when I call the function the pointer is still there and the window locks, the mouse can still be used but I can't get out of screen (even kill won't work).

I think it may be due to my understanding of where to call the function. I call it directly
after createGLWindow(.. fucntion using 1 or 0 dont help

Share this post


Link to post
Share on other sites
Strange...
Your modified code should work. I downloaded lesson 10, added your code

void setVisible(Bool visible)
{
if(!visible)

{

char data[] = {0};

Cursor cursor;

Pixmap blank;

XColor dummy;

blank = XCreateBitmapFromData(GLWin.dpy, GLWin.win, data, 1, 1);

cursor = XCreatePixmapCursor(GLWin.dpy, blank, blank, &dummy, &dummy, 0, 0);

XDefineCursor(GLWin.dpy, GLWin.win, cursor);

XFreePixmap(GLWin.dpy, blank);

XFreeCursor(GLWin.dpy, cursor);

}

else

XUndefineCursor(GLWin.dpy, GLWin.win);

}



and I call "setVisible(False);" after "createGLWindow(...)" in the main function. Works fine with my SUSE 10 and Ubuntu 6.06 .

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Thanks, it work, I had a bit of test code left from when I'd been getting it to work before. Sorry about that

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!