: Thanks to all those who sent me mail or followed up to
: my posting on "how to change the colormap cells on the
: fly".
:
: I am including some code here, which lets the programmer
: figure, how not to touch the color cells of the colormap
: which are getting used by other applications on the same
: display, and use the rest of the colormap.
:
: Thanks again for all your help.
:
:
: SetupMyColormap()
Before one thinks about using method to determine colormap cells in use, there
are several points which should be brought up about it's shorcomings.
1) The number of unused cells in the colormap and the number of read/write cells
which can be allocated is not necessarily the same number.
2) This approach makes a copy of the std colormap at an instant in time. There is nothing to say that clients may not have their own read/write color cells
and change them in the default map. They would not be changed in your map
and flashing would occur.
3) Read only color cells do not necessarily keep the same rgb value for the
lifetime of the server. The server may free read only cells when no client
has it allocated, or as in the case of the NEWS server, the server may try to limit flashing and modify the colormap as focus is changed.
4) The window manager handles the swapping of colormaps based on focus. If you
are installing read/write color cells in a private map, they are not being
installed in any other color maps which may be installed by the window
manager. Your application will not show up correctly when focus is changed
from your window.
In summary, X does not provide the application sufficient information to eliminate flashing whenever private colormaps are used.