PDA

View Full Version : hiding mouse



schailan
05-30-2002, 05:15 AM
hi,

i just need to hide the hotspot og the mouse when i move it for a camera moving!!!

how to do that!!!

i work under X windows system, on linux not Windows!!!

is that a link with GLX?

zen
05-30-2002, 06:39 AM
If you're using some widget library like gtk you're on your own,although it should be pretty easy.
If you're using Xlib calls though I recently came across this problem myself.I didn't find a XHidePointer function or something simlar but you can bind a specific pointer graphic to every window.So when you need to hide your window just bind a pointer that is totally trnasparent.I know that X offers a set of pointers,there should be a transparent one there.Have a look at the Xlib manuals and post if you find anything.I'll have a look as well if I find the time(damned semester finals)

richardve
05-30-2002, 03:35 PM
X offers indeed a set of mouse pointers, but the pointer which should be transparent isn't really transparent (defaults to the normal left arrow)

AFAIK this is the only way to to hide the cursor:




Cursor cur;
Pixmap bp; // short name for blank pixmap
XColor dummy;
char data[1] = { 0 };

bp = XCreateBitmapFromData(GLWin.dpy, GLWin.win, data, 1, 1);
if (bp == None) printf("Aaaaargh! Somebody help! I'm out of memory!");
cur = XCreatePixmapCursor(GLWin.dpy, bp, bp, &dummy, &dummy, 0, 0);
XFreePixmap(GLWin.dpy, bp);
XDefineCursor(GLWin.dpy, GLWin.win, cur);




Hm, I'm not sure since I'm currently working with XP (very, very temporary) so I can't try it, but I think the cur variable should be deallocated @ program exit.



[This message has been edited by richardve (edited 05-30-2002).]

zen
05-31-2002, 01:34 AM
An other alternative(especially if you have loaded some font for an other purpose) is to use XCreateGlyphCursor() and specify the source glyph as the space character.That should do the trick as well.