Stephen J Turnbull writes:
Stephen> This isn't true in theory; O'Reilly's Xlib Programmer's Guide
claims
Stephen> it wasn't true in practice (even as of the X11R4 edition). A server
Stephen> can implement multiple hardware colormaps, and there will not
Stephen> necessarily be any flashing when different window use different
Stephen> colormaps.
Yup. This is probably why Martin didn't notice any flashing.
Stephen> you _can't_ have a private colormap with Truecolor (I think, or is
Stephen> that directcolor?.
The concept of "private" colormap is meaningless in the case of
TrueColor. You can perfectly well create your own TrueColor colormap, but
the color cells are Read Only, and have predefined values assigned by
the server. On the other hand, a DirectColor colormap is like a TrueColor one,
except that the cells are modifiable.
Stephen> ? Those are orthogonal options, aren't they?
Not completely.
Stephen> If the server allows you to specify a visual, it has to provide a
Stephen> compatible default colormap.
Don't be so confident in X ;-) When you create an XWindow, you may
assign it a particular visual and colormap. The obvious constraint is that the
colormap must be of the same visual type as the window (this is why the
options are not completely orthogonal). But the point is that by default, the
colormap assigned to a newly created window inside the XWindowAttribute
structure is CopyFromParent. Consequently, if for instance you create a
TrueColor24 XWindow on a PseudoColor8 (by default) screen and don't
explicitely give it a proper colormap, you'll get a BadMatch error.
This brain damage in the conception is also visible with the
Intrinsics widgets and Motif. A naive Motif application running under the same
circumstances as described above will crash immediately when you try to open a
menu. This is because the menus widgets (which inherits from Shell) inherits
the visual and depth from their parent WIDGET, but the colormap from their
parent WINDOW. Hence the BadMatch error.
--
/ / _ _ Didier Verna
http://www.inf.enst.fr/~verna/
- / / - / / /_/ / E.N.S.T. INF C201.1 mailto:vernaļ¼ inf.enst.fr
/_/ / /_/ / /__ / 46 rue Barrault Tel. (33) 01 45 81 73 46
75634 Paris cedex 13 Fax. (33) 01 45 81 31 19