Duane Clark dclark@leewardfpga.com writes:
The main ugly hack that is performed here is in determining whether a pixel is a foreground or background pixel. This is done by adding the red, green and blue values for each pixel, and testing whether they exceed an arbitrary threshold. This should probably be a reasonably safe method, since presumably any cursor will have a high level of contrast between foreground and background colors.
It's reasonable, but you should be doing this locally in the X image before transferring it to the server; painting the pixmap in the server pixel by pixel is going to be quite slow. And you may want to have a look at CURSORICON_IconToCursor, it does something similar.