xcmap is a program that displays the contents of the default colormap on 
4-, 6-, and 8-bit X11 displays.  It displays the colormap both as a grid of
colored rectangles, and as RGB components.

This is a very useful thing to anybody who's trying to do color-intensive
programs (such as displaying GIF pictures...) on X.

It's also kind of neat to watch.

John Bradley  -  bradley@cis.upenn.edu


PATCH 1:
  Contributed by Dave Gorgen / Apollo Computer Inc (dpg@citi.umich.edu)
  Allows xcmap to run on X servers that pre-allocate colors for the cursor,
  returning an "XDisplayCells()" value != a power of 2.  This would include
  Apollos, DEC QDSSs, and no doubt some other machines.

-------------
(The full description of the problem, from Dave's letter...)
    I was happy to see xcmap posted on comp.sources.x; it's one of those
programs I always meant to write but never got around to.

    However, when I ran it on my Apollo server I got:

xcmap: dispcells = 254.  This program can only deal with 4, 6, and 8-bit display
s.

    The problem is that xcmap, like many color X clients, incorrectly assumes
that if a visual is n bits deep, it must support exactly 2**n colormap entries.
The protocol explicitly allows fewer entries; this fact is used by several X
servers (Apollo color servers, DEC QDSS servers, and perhaps others) to reserve
2 slots for the cursor colors.  Unless the display hardware has a 2-color cursor
sprite, this is the only correct way to do a color cursor that I know of.

    (The Sun color cursor support on the MIT tape, which allocates the cursor
colors dynamically out of the default color map, is acknowledged by the author(s
)
to be wrong.  I don't know how IBM, HP or MacII color displays do cursors.)

    Anyway, I modified xcmap to accept any value it finds for dispcells <= 256.
It will draw the same square array of pixels, including the out-of-bounds ones,
but if you select an out-of-bounds pixel to display its RGB values, it will
just say that the pixel is out-of-bounds.  For what it's worth, this also allows
xcmap to run on monochrome displays, albeit rather boringly.
------------------

PATCH 2:

  Contributed by David Elliott at Sony Microsystems (dce@smsc.sony.com)
  The icon is now a small copy of the colormap window.

PATCH 3:

  Contributed by Noel S. Gorelick <ngorelic@speclab.cr.usgs.gov>.
  Adds a -ig (icon gemoetry) argument.  This only sets the icon
  position, not the size.

PATCH 4:

  Contributed by Paul Stewart <stewart@isis.ecse.rpi.edu>.
  Modifies the above icon geometry so that it adds hints to the icon manager
  only if an icon geometry was specified on the command line.

PATCH 5:

  Contributed by Paul Stewart <stewart@isis.ecse.rpi.edu>.
  Adds MappingNotify to the event type case loop, to prevent unwanted exits
  of the application.
