[comp.windows.x] cursor color

koolish@bbn.com (Dick Koolish) (06/13/90)

A question about the cursor color...

XRecolorCursor takes two XColor structures, one for foreground
and one for background colors.  The structures specify the color
number and the RGB values.  I have an application that uses three
color maps that share some colors, and I want the cursor to be one
of the shared colors so it won't change color when I change colormaps.
Whatever I do, it seems like the cursor is always using colors
0 and 1 regardless of what XRecolor Cursor says.

In looking through the sources, I found the _Cursor structure in
src/server/include/cursorstr.h.  It holds the RGB values for
foreground and background but doesn't seem to have the color number
in there.  Does this mean that the color number is ignored?

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (06/13/90)

    In looking through the sources, I found the _Cursor structure in
    src/server/include/cursorstr.h.

You would have been better off looking at the RecolorCursor request
definition in the X Protocol specification.

    Does this mean that the color number is ignored?

Yes.  Xlib uses XColor structures here because it was more "convenient"
than defining another structure.

stroyan@hpfcso.HP.COM (Mike Stroyan) (06/14/90)

> XRecolorCursor takes two XColor structures, one for foreground
> and one for background colors.  The structures specify the color
> number and the RGB values.  I have an application that uses three
> color maps that share some colors, and I want the cursor to be one
> of the shared colors so it won't change color when I change colormaps.

The cursor may not be displayed in the colormap of the current
colormap focus window.  Some servers have separate hardware cursors
that use a different colormap.  Given this possibility it is wise
that the cursor colors are set in RGB values.

If a server draws a cursor in the frame buffer it should recompute the
cursor indices to match the requested RGB values whenever it installs a
new colormap.  If the X server doesn't update the cursor to match the
colormap, then there isn't much that a client can do about it.

Mike Stroyan