[comp.windows.x] HELP with DECstation 5000/200 24bit color & XAllocColorCells

knight@henson.cc.wwu.edu (Matt J. Scott) (04/10/91)

Please Help!

We, at Western Washington University, are now the proud owners of several new
DESstation 5000/200.  Two of which are expanded with 24-bit color capibility.
The problem is that XAllocColorCell will always return FALSE (on the 24-bit 
machines).  So to try and track down the problem I did some digging and testing
and discovered that the 24-bit machines do support a DirectColor visual (read/writeable),
however, it is NOT the default visual!  Does XAllocColorCells only try the default
visual? How can we change the default visual from a read only to the read/write visual?

Any help would really make my day because many of the applications that run on the
8-bit machines we have will not run on our 24-bit machines, and I have been pulling
my hair out trying to fix this!

klee@wsl.dec.com (Ken Lee) (04/10/91)

In article <1991Apr9.174106.2727@henson.cc.wwu.edu>, knight@henson.cc.wwu.edu (Matt J. Scott) writes:
|>  Does XAllocColorCells only try the default visual?

XAllocColorCells() requires a colormap argument.  Colormaps must be
created for particular visuals.  A robust client should make sure that
its windows, colormaps, and graphics context fields all use the same
visuals.

-- 
Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee

cflatter@zia.aoc.nrao.EDU (Chris Flatters) (04/10/91)

Matt Scott writes:
> So to try and track down the problem I did some digging and testing
> and discovered that the 24-bit machines do support a DirectColor visual
> (read/writeable), however, it is NOT the default visual!  Does
> XAllocColorCells only try the default visual?

XAllocColorCells will only try the colormap you specify as its second
argument.  If you want to use a non-default visual you must create a
private colormap using XCreateColormap with a pointer to the visual
you want to use. 

> How can we change the default visual from a read only to the
> read/write visual?

Some X servers will allow you to change the default visual at start-up.
I don't know if DEC's is one of them: check the man page.

Chris Flatters

mikey@sgi.com (Mike Yang) (04/10/91)

In article <9104100234.AA16796@zia.aoc.nrao.edu> cflatter@zia.aoc.nrao.EDU (Chris Flatters) writes:
>XAllocColorCells will only try the colormap you specify as its second
>argument.  If you want to use a non-default visual you must create a
>private colormap using XCreateColormap with a pointer to the visual
>you want to use. 

For an example of this, get cpicker.tar.Z from
export.lcs.mit.edu:~ftp/contrib.  This is my colormap manipulation
program, and it searches for a suitable PseduoColor visual to work
with.

-----------------------------------------------------------------------
                 Mike Yang        Silicon Graphics, Inc.
               mikey@sgi.com           415/335-1786

mouse@lightning.mcrcim.mcgill.EDU (der Mouse) (04/11/91)

> The problem is that XAllocColorCell will always return FALSE (on the
> 24-bit machines).  So to try and track down the problem I did some
> digging and testing and discovered that the 24-bit machines do
> support a DirectColor visual (read/writeable), however, it is NOT the
> default visual!  Does XAllocColorCells only try the default visual?

No; it tries only the visual of the colormap you give it.
XAllocColorCells takes a colormap as an argument; that colormap
implicitly specifies the visual.  (Colormaps are visual-specific.)

> How can we change the default visual from a read only to the
> read/write visual?

This may or may not be possible.  Some servers support some way to
specify which visual is the default (command-line switches, for
example); others don't.  I would suggest you not depend on this being
possible, for even if it is with your servers, someday someone will
want to run the program in question on some other server that doesn't
support it.  Instead, make sure you find the visual you want and use it
when creating your windows and colormaps.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu