[comp.windows.x] Colormap full

vania@mirsa.inria.Fr (Vania Jolobof) (01/13/89)

Assume I want to allocate N colors in any number of planes using:

   XAllocColorCells(myDisplay, myColormap, False, (unsigned long *)NULL, 0, colors, N)

and this fails because the colormap is full. 
I have not found in the documentation what happens then.
Are there P colors (P < N) allocated however ? Is P equal to zero ?

It seems to me that the client should be able to know in case of
failure how many colors have been allocated, and which one.
So the client could call: 

     newmap = XCopyColormapAndFree(myDisplay, myColormap)

and then allocate the N-P lacking colors in the new colormap.

I suggest XAllocColorCells should return in the *pixels_return* parameter
the array of pixels effectively allocated with a convention to discover P for the client.
There are several ways to achieve that:
1) XAllocColorCells would simply return P. It is not specified today what it returns...
2) the pixels_return array would be NULL terminated.
3) the first element in the pixels_return would be a dummy one and specify P.

Vania Joloboff -- vania@mirsa.inria.fr