[Xcb] xcb-util: ewmh library

Peter Harris git at peter.is-a-geek.org
Fri May 22 08:33:52 PDT 2009

On Fri, May 22, 2009 at 9:52 AM, Arnaud Fontaine wrote:
>>>>>> Barton C Massey <bart at cs.pdx.edu> writes:
> Hello,
>    >  Just  remember that  latency,  not  bandwidth,  is the  important
>    > limiting  factor on X.  This  suggests that you  should create and
>    >  cache   all  the   EWMH  atoms  with   a  single   round-trip  at
>    > initialization  time.  Note that  the cookie magics [1]  should be
>    >  working for you  here; you  don't need  to force  the InternAtoms
>    > reply  and cache the result until  the first time you  need one of
>    > the atoms.
> Thanks for the  link :). But well, at the  moment the atoms (xcb_atom_t)
> are  given as  function  arguments, therefore  it  makes the  API a  bit
> heavier but it is much flexible IMO because it allows program using this
> library  to implement  the cache  in their  own way  (using hash  map or
> whatever  else) and  usually  it has  already  been done  in the  window
> manager using their own data structure. But well, as mentioned before it
> is not really  convenient because it makes the API  heavier, what do you
> think?

I agree with Bart.

A single round trip to InternAtom all the EWMH atoms is a small price
to pay for a much simpler API. And, as Bart points out, you don't even
have to pay for the round trip if you only issue the requests at
initialization time and let the cookie magic work.

As to allocating memory... the list of EWMH atoms you need is
statically known at compile time. A dozen cookies plus a dozen atoms
is still only going to be ~96 bytes. That might have been a lot back
when people were doing useful things with the cassette buffer on a
C64, but it's utterly trivial today.

Peter Harris

More information about the Xcb mailing list