[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

2098.0. "free read/write pixels again!" by CERN::EJM () Mon Jan 22 1990 06:13

    It seems to me that just about anyone who wants to do anything with a
    DECWindow that has to do with color graphics wants to find out how many
    read/writable pixels exist on their X-Server and they want them in a
    nice list. With all the silly convenience routines that are provided
    with Xlib, why isn't this one of them??  What is the thinking behind
    not providing this??
    
    int *rw_pixel_list;
    
    	rw_pixel_list = XFindFreePixels( dpy, &visual_info );
    
    for example, where you've fill 'visual_info' with the depth, and screen
    stuff that's needed.
    
    I've written this routine, more or less, and it seems to work but it's
    a pain in the tusch(sp?).  I think it would be nice not to force
    others to find out the hard way about how to do this.
    
    Thanks,
    	John
T.RTitleUserPersonal
Name
DateLines
2098.1Synchronizing is a problemCLTVAX::dickDick Schoeller - Failed XperimentMon Jan 22 1990 10:259
With the multi-client, multi-server, multi... model, there is a fairly high
probability that you could get collisions on that sort of information exchange.
The typical one is I ask for the number of colors, the server answers, while
I am deciding what to do with them you reserve some.  When my color request
comes along, there are fewer than I thought.  That is why an algorithm that
attempts to allocate and then tries alternative approaches based on success
or failure is superior to asking and the reserving.

Dick
2098.2Thoughts from Mr. MotivationCALL::SWEENEYPatrick Sweeney in New YorkSat Jan 27 1990 20:5824
    I'll answer the direct question: The philosophy of X is "allocate, then
    succeed or fail".  This is true of all the server-allocated resources.
    There is no convenience routine to tell you how many more windows can
    be allocated, or what the largest pixmap that can be created is.
    
    I'll reinforce the point made in the earlier reply:  Take the
    asynchronous multiple-access nature of X very seriously  Whatever
    number the server (hypothetically) tells you is the free number is
    potentially not valid at the time your client reads it as other clients
    may have allocated the pixel values by the time you get around to
    allocating them.
    
    Most of the "silly" convenience routines of Xlib return time-invariant
    values.  Having the server return values for shared resources that vary
    over time leads to a very large class of potential client application
    errors.  Note the common Xlib error of writing to a
    created-but-not-yet-mapped window.  Timing is everything.
    
    To tackle the premise of .0: No, I don't think that a Xlib application
    needs to find out how many read/writeable pixels exist in the server
    (you must mean the available entries in a pseudocolor colormap).  I
    think it would be really distracting or confusing to have the
    appearance of an application change based on whether 10 or 12 colors
    were available.
2098.3response accepted, but...CERN::EJMMon Jan 29 1990 05:1827
    Thanks for your responses.  I must admit the multi-server/multi-client
    allocation problem had not occured to me before.  This makes it clear
    why the server would want to allocate all time-variant quantities when
    asked.
    
    I must say, however, that even if I accept the fact that my
    XFindFreePixels routine should be XAllocFreePixels, it still should
    exist, encapsulating the famous XAllocColors in a loop trying to find
    all the available pixels in the colormap of the server to which one is
    attached.  This would be as least as convenient as say XtSetSensitive
    is in the toolkit; replacing mabye two lines of code with one.
    
    Also, I may be working in a somewhat closed environment, but my
    applications always try to get as many pixels are available and then
    create an HLS color scheme with those that are read/write.  It
    definately changes the way my application looks and works if there is
    24 not 124 pixels available.  This I have seen on workstations running
    PHIGS.  My applications are strictly imaging and thus NEED a spectrum
    of colors to be effective, I think.  In these situations, using named
    colors for instance is not acceptable.
    
    This, however, is a rat-hole, I would say.  Noone is going to put a
    routine like this in the next release of DECWindows because of this
    note and I got a reasonable answer already.
    
    Thanks,
    	John
2098.4Pat has a point about consistencyCLTVAX::dickDick Schoeller - Failed XperimentMon Jan 29 1990 08:3516
John,

I think Pat has a point about consistency.  While it is useful for your
application to make do with what it can get (ie: it will never get 128 colors
on a 4 plane VS2000) it also makes sense to try for as much consistency as
possible.

One approach to that would be to use some scheme to attempt to allocate as many
colors as possible from the default color map.  If that is below some minimum
value (or percentage of the colors available) then attempt to use a private
colormap.

Approaches like that prevent the application from degrading to far on a heavily
used system.

Dick