"Stefan Monnier" <monnier+gnu/address@hidden> writes:
[...]
As someone whose colormap is full about 95% of the time, I can
assure you that tose things happen ;-)
Really? I guess I've been spoiled by my video card (which is a not very
respectable 4M matrox) and more respectable lack of use of colors :)
The shame of not caching the XFreeColors has caught up with me, so I added
a refcount and a wrapper for XFreeColors that takes advantage of the
refcount (so the X server only sees the Free request once per cached color,
and upon final Free'ing, the cache entry is removed). This ensures there
are no stale entries in the cache. The performance hit is negligible in
my
tests.
The newest versions of xcache.[ch] reflect:
- Reformatted function calls to K&R style
- Added a lot of comments to explain what's going on
- Added refcounting & XFreeColors caching
Note that in order to take advantage of the XFreeColors caching, you need
to add the xcache.h header to other files. Included is also a patch that
does that.