Hi, Experts, 

I'm kind of new to X. The following question is strange to me. I am
trying to modify the contents of the colormap but failed without
reason (to me). I am using the following piece of code:


  toplevel = XtInitialize(argv[0], "Testcolor", NULL, 0,
			  &argc, argv);
  dpy = XtDisplay(toplevel);
  scr = DefaultScreen(dpy);
  def_colormap = DefaultColormap(dpy,scr);

  if(XAllocColorCells(dpy, def_colormap, True, NULL, 0, cells, 5)) {
    color.pixel = cells[0];
    color.red = 250;
    color.green = 125;
    color.blue = 0;
    color.flags = DoRed | DoGreen | DoBlue;
    XStoreColor(dpy, def_colormap, &color);
    printf("\n Try to allocate, the color %d as (%d,%d,%d)",
	   color.pixel, color.red, color.green, color.blue); 

    XQueryColor(dpy, def_colormap, &color);
    printf("\n After  allocate, the color %d is (%d,%d,%d)",
	   color.pixel, color.red, color.green, color.blue); 
  }
  else
    printf("\n Error: couldn't allocate color cells");


Running output:

     Try to allocate, the color 7 as (250,125,0)
     After  allocate, the color 7 is (0,0,0)

After XStoreColor(), XQueryColor() just returned the original value. 
No failure/error displayed but the contents of colormap are obvious
unchanged. (I also tried to draw a line using the colors but it 
turned out to be the unmodified colors.)

So what is my problem? How to modify the contents of the colormap?

Any help/information will be appreciated. Please send mail to
"yang@cs.umass.edu".

--------------------------
William 
email: "yang@cs.umass.edu"
--------------------------


By the way, the following is the environment I am using (output of
"xdpyinfo"). It shows the default visual is PseudoColor.

version number:    11.0
vendor string:    DECWINDOWS DigitalEquipmentCorporation UWS4.2
vendor release number:    1
maximum request size:  16384 longwords (65536 bytes)
motion buffer size:  100
bitmap unit, bit order, padding:    32, LSBFirst, 32
image byte order:    LSBFirst
number of supported pixmap formats:    2
supported pixmap formats:
    depth 1, bits_per_pixel 1, scanline_pad 32
    depth 8, bits_per_pixel 8, scanline_pad 32
keycode range:    minimum 86, maximum 251
number of extensions:    8
    Adobe-DPS-Extension
    DPSExtension
    SHAPE
    MIT-SHM
    Multi-Buffering
    XInputExtension
    MIT-SUNDRY-NONSTANDARD
    DEC-XTRAP
default screen number:    0
number of screens:    1