home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!know!cass.ma02.bull.com!think.com!rpi!usc!cs.utexas.edu!torn!utcsri!newsflash.concordia.ca!sifon!thunder.mcrcim.mcgill.edu!mouse
- From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
- Newsgroups: comp.windows.x
- Subject: Re: Finding out the number of 'free' cells in the color map
- Keywords: color map, color cells
- Message-ID: <1992Nov15.193125.19911@thunder.mcrcim.mcgill.edu>
- Date: 15 Nov 92 19:31:25 GMT
- References: <1992Nov13.072332.27682@mailhost.ocs.mq.edu.au>
- Organization: McGill Research Centre for Intelligent Machines
- Lines: 28
-
- In article <1992Nov13.072332.27682@mailhost.ocs.mq.edu.au>, s8923098@macnab.mqcs.mq.oz.au (Josef WIDJAJA) writes:
-
- > I want to use XAllocColor many times to allocate color cells that can
- > be shared by other applications. But I want to know in advance how
- > many of these will be available. How can I do this ?
-
- You can't. For one thing, it depends on exactly what colors you're
- allocating, because you may match colors that are already allocated and
- hence get an already-allocated cell instead of a new one. Even if you
- rephrase it to ask "how many cells are unallocated", there is no simple
- way to answer it; you have to try it and see. (Unless you want to
- design and implement an extension, of course.)
-
- > [code example]
-
- > I want to know how many color cells are going to be available so that
- > I can adjust the value of maxno, and prepare data[i]'s accordingly.
- > More specifically, I want to make sure that result is always
- > succesful(true).
-
- Can't be done. Even if you did contrive somehow to find out how many
- cells are free, other clients could allocate cells while you're
- working. You'd have to grab the server to prevent this....
-
- der Mouse
-
- mouse@larry.mcrcim.mcgill.edu
-