Hrvoje Niksic wrote:
> XCreatePixmapCursor only accepts pixmaps of depth 1, so the
cursor
> can only have two colours (plus a mask).
This is strange. How come this worked right under my old, 8bit
display?
Are you sure that it did? Have you tried using a pointer with many
different colours?
recycle.xpm has three colours (plus mask); black plus two shades of
green (chartreuse1 and chartreuse4). On an 8bpp PseudoColor display, I
suspect that you get black plus one of the shades of green.
rgb.txt contains:
0 0 0 black
127 255 0 chartreuse1
69 139 0 chartreuse4
On a DirectColor or TrueColor display, with the blue component in the
least significant bits (which is the case for me), then all of the
pixel values will be even. According to the comment in glyphs-x.c,
this will result in the image being a single colour (which appears to
be chartreuse4).
> My guess (and it is just that) is that on an PseudoColor
display,
> the foreground and background colours would often be allocated
> adjacent colourmap cells, resulting in one being odd and the other
> being even, whilst on a DirectColor display, the values would be
> fixed.
I'm not sure I can follow you, and I'm not strong on the X terminology
either, so please bear with me. As far as I know, my old visual was
8bit PseudoColor, while my new visual is 16bit TrueColor (the latter
is reported by xdpyinfo.) It continues to amaze me that on a
TrueColor display XEmacs is unable to get the pointer drawn right.
Can this really be right?
XEmacs could do it better, although it would have to perform the
colour to mono conversion itself. Currently it uses
XpmCreatePixmapFromBuffer to convert the Xpm into a 1bpp Pixmap by
taking only the bottom bit from each pixel.
Basically, the Xpm format isn't suitable for cursors; it's better to
use a pair of XBMs instead, e.g.
(set-glyph-image gc-pointer-glyph
(vector 'xbm
:file "recycle-image.xbm"
:mask-file "recycle-mask.xbm"
:foreground "black"
:background "chartreuse1"))
where recycle-{image,mask}.xbm are the attached files.
--
Glynn Clements <glynn(a)sensei.co.uk>