Can anyone show me how to make a bitmap cursor in CLX? I seem to get
errors no matter what I try. I want to use xlib:create-cursor, but
have no idea what data format you enter for the source and the mask.
Under C you can use XCreatePixmapFromBitmapData with a char array to
create the pixmap you use in XCreatePixmapCursor. Since CLX doesn't
seem to have functions like these, I have no idea what you do....
As I understand it, the 'pixmap' used by create-cursor is really a
bitmap. The rule is that each BIT in the pixmap/bitmap is drawn as
either the forground or background color or not at all (1/0 1/1 0/0).
That means that you need to send create-cursor two series of bits
defining your image and it's overlay (mask). That said, the problem
I'm having is defining the bitmaps. As I said above, in C you can
create a char array where the bits in the characters are what are used.
How do you do this in Lisp? I've tried creating a bit array, but
can't seem to compile it. (SBCL, which I'm using, defines a
bit-vector data type, but when I try to compile an array of bit-vector
type, I get a bad function error.) The key to the problem is to be
able to code two arrays of bits into variables and feed them to the
create-cursor function.
I still can't get this to work. I create a pixmap and mask with the
depth set to 1. (I have tested the bit definitions by drawing them to
a regular window and they look fine) (The mask and source at the same
size - 16/16) When I create my cursor using the source and mask, I get
no errors. However, I get a cursor that is garbage. It works. I
shows up when it should. But the image is a mess. It's as if the
pixels are not lining up where the should. I'm sort of at an
impasse.....
Well, finally! I got it to work. The trick was to fill the pixmap
with zeros at the start. Then
setting foreground to 1 when drawing the image of the mask and src
fixed the problem.
Thanks for the effort....
Bill