[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

970.0. "Which color cells are reserved by Server?" by CSC32::JJONES (Jeff Jones) Sat Jun 17 1989 15:19

    Well, I honestly have looked through all of the titles with 'COLOR'
    in them to see if there is something which closely coiincides with
    this. Obviously since I am writing this I didn't find anything.
    Also, what happened to the DECWINDOWS_PROGRAMMING conference; is it
    still around?; I can't access it; so if it is still there feel
    free to move it.
    
    Here goes...
    
    	I have a 4 plane system. I've got an application in mind which
    	will need to create a private color map and/or use the default
    	for the necessary colors. Is there a way to determine which colors
    	of the color map (RGB and pixel value) are allocated by the 
    	Server, WM, or SM - as opposed to the ones which are allocated
    	only by other clients?
    	This is so I don't mess with the entries for Server colors where
    	I might get myself in trouble by changing text foreground to the
    	same as the background and other reasons.
    
    Any suggestions?
    jjjones

T.RTitleUserPersonal
Name
DateLines
970.1I don't think there is a way to find outHANNAH::MESSENGERBob MessengerSat Jun 17 1989 18:3343
Re: .0

The server and toolkit allocate read-only colors as needed, and you *can't*
change those colors, as far as I can tell.  Your choices are:

	(1) Call XAllocNamedColor to ask for a specific color. If another
	    application is already using that color you'll share the same
	    color map entry (and can't change it).  If that color hasn't
	    already been allocated and there are unused entries in the
	    default colormap, the server will allocate a color number for
	    you, set color entry to the color you asked for, and mark the
	    entry as read-only.  If there are no free entries XAllocNamedColor
	    returns an error.

	(2) Call XAllocColorCells (or another routine) to allocate one or more
	    colormap entries for your exclusive read-write use.  If there
	    aren't enough entries available in the default colormap
	    XAllocColorCells will return an error.

	(3) Call XCreateColormap to create your own private colormap for your
	    exclusive read-write use; you'll also need to call
	    XSetWindowColormap and possibly XLoadColormap.  When your window
	    gets the input focus the window manager will set the hardware
	    colormap to your colormap, and your window will be the only one
	    displayed in its true colors.  When your window loses the input
	    focus the hardware colormap reverts to the default colormap, so
	    your window won't be displayed in its true colors.  I got a lot
	    of complaints when I did this in DECterm.

You can also combine these methods: you can try allocating entries from the
default colormap as in (1) or (2), and if the allocation fails you can create
a private colormap by calling XCopyColormapAndFree; this creates a new colormap
and copies all your entries from the default colormap to the new colormap and
frees them in the default colormap.

What I'd like to be able to do is to look at the colors that exist in the
hardware colormap and find out which ones are available for shared access;
that way I could ask for a color, say OrangeRed, say DarkOliveGreen, and if
XAllocNamedColor failed I could fall back to the closest available color, say
DarkGreen.  As far as I can tell, though, there is no way to do this.

				-- Bob