home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!lsl!snail
- From: snail@lsl.co.uk
- Newsgroups: comp.windows.x
- Subject: Re: How to let the pointer disappeared?
- Message-ID: <1993Jan4.165028.2882@lsl.co.uk>
- Date: 4 Jan 93 16:50:28 GMT
- References: <1992Dec25.181545.21726@sparc4.ncu.edu.tw>
- Organization: Laser-Scan Ltd., Cambridge
- Lines: 78
-
- In article <1992Dec25.181545.21726@sparc4.ncu.edu.tw>, u438813@ba.ncu.edu.tw (Lin Wei-Ting) writes:
- > I want to let the pointer disaooeared when the pointer enters a canvas.
- > How should I do ?
- >
- > Thanks..
-
- Create a pixmap which has no pixels set in it. Do this using
-
- Pixmap pixmap;
- Display *display;
- Window window;
- char *bitmapdata;
- int width, height;
-
- pixmap = XCreatePixmapFromBitmapData(display,
- window,
- bitmapdata,
- width, height,
- (unsigned long)1, (unsigned long)0,
- 1);
-
- Note that if bitmapdata points to some memory that contains all 0 data then
- this provides you with no pixels set in it. Set Width and Height as
- appropriate.
-
- Now (for completeness) get the foreground and background colours...
- This is not needed if you're setting a blank pixmap, but really your code
- should be reusable and this lot should be part of something greater....
-
- Screen *screen;
- XColor bg, fg;
-
- screen = ScreenOfDisplay(con_get_frontend_display(),
- DefaultScreen(con_get_frontend_display()));
- fg.pixel = BlackPixelOfScreen(screen);
- bg.pixel = WhitePixelOfScreen(screen);
-
- if (fg.pixel == bg.pixel)
- {
- printf("Black and white default pixels are the same");
-
- /* handle your error here */
-
- return;
- }
-
- fg.flags = (char)(DoRed | DoGreen | DoBlue);
- bg.flags = (char)(DoRed | DoGreen | DoBlue);
-
- /* now query to get the correct RGB for these pixel values, we */
- /* query the default colour map */
-
- XQueryColor(con_get_frontend_display(),
- DefaultColormap(con_get_frontend_display(),
- DefaultScreen(con_get_frontend_display())),
- &bg);
-
- Then set this pixmap as the pixmap cursor using
-
- int hotspot_x, hotspot_y;
-
- XCreatePixmapCursor(display, pixmap, pixmap,
- &fg,
- &bg,
- hotspot_x, hotspot_y);
-
- hotspot_x and hotspot_y specify where the hotspot goes, often set this to
- width/2 and height/2 respectively.
-
- OK? All this has been selected and edited from code we have here.... at least
- I don't think I've added typos in the editing..
- --
- snail@lsl.co.uk
-
- "Washing one's hands of the conflict between the powerful and the powerless
- means to side with the powerful, not to be Neutral."
- Quote by Freire.
- Poster by OXFAM.
-