On Thu, Oct 20, 2005 at 11:06:36AM +0200, Dominik Vogt wrote:
> On Thu, Oct 20, 2005 at 07:42:36AM +0200, Viktor Griph wrote:
> > Hi
> > 
> > I am looking into the MenuStyle code trying to understand how some things 
> > are done. I plan to enable negation of all on/off menu styles by prefixing 
> > ! to them. However looking at the code raise some questions:
> > 
> > First of all what exactly does FreeColors free up?
> 
> In certain modes, X colours are managed in so called colour cells.
> There may be a limited number of available cells.  They are
> reserved with XAllocColor and freed with XFreeColor.  Because
> colours are used in many places inside fvwm (colour sets!), fvwm
> keeps a reference counter for the allocated colours.  The
> corresponding code may be a bit difficult to understand
> (libs/PictureUtils.c).
> 
> FreeColors eventually decreases the reference counters and frees
> the cells if the reference count drops to 0.  Actually the process
> is more complicated.  I think Olivier has written most of the
> code.
>

Yes, the code is complex. It allows, in particular, to save in a
"fast" way the allocated pixels for an image or a gradient with
minimal memory usage. Before that, colours leak was systematic with
gradients and images. Any way, colours management (sharing) at depth 8
is a mess in the X world, I discourage any one to try to understand
the problems :o)

Note that we do not receive complaint anymore on colours at depth 8 on
fvwm-users. Maybe, no body have to use anymore these applications
which need depth 8 to work properly.

Olivier

Reply via email to