creating bit windows on bit display how greetings i am using an x server that provides visuals pseudocolor bit truecolor bit and directcolor bit a problem occurs when i try to create a window with a visual that is different from the visual of the parent which uses the default visual which is tc in the xlib reference guide from o reilly one can read in the section about xcteatewindow something like in the current implementation of x when using a visual other than the parent s be sure to create or find a suitable colourmap which is to be used in the window attributes when creating or else a badmatch occurs this warning strangely enough is only mentioned in the newer editions of the x r guides however even if i pass along a suitable colourmap i still get a badmatch when i create a window with a non default visual the code looks like this cut here and you ll destroy your crt window create bit window on truecolour display dpy width height display dpy int width height window win xvisualinfo vinfo xsetwindowattributes attr fprintf stderr opening bit window n if xmatchvisualinfo dpy defaultscreen dpy pseudocolor vinfo fprintf stderr your display can t handle bit pseudocolor n exit fprintf stderr using visual x n vinfo visual visualid cmap xcreatecolormap dpy defaultrootwindow dpy vinfo visual allocnone xsync dpy false xinstallcolormap dpy cmap ommision of this line gives same result attr colormap cmap win xcreatewindow dpy defaultrootwindow dpy width height copyfromparent border width depth inputoutput class vinfo visual visual cwcolormap attr return win cut here and you ll destroy your crt executing this piece of code results in a badmatch error anybody who knows why if so please drop me a line take care bram stolk stolk fwi uva nl
