[Xcb] making the icccm functions async

Barton C Massey bart at cs.pdx.edu
Sun Apr 8 15:39:19 PDT 2007


In message <Pine.LNX.4.64.0704080949370.27950 at grozny.maths.univ-evry.fr> you wrote:
> I would like to make the icccm related functions async.

This seems obviously to be the right thing to do...

> These functions are:
> 
> xcb_get_wm_name
> xcb_get_wm_icon_name
> xcb_get_wm_client_machine
> 
> xcb_get_wm_size_hints
> xcb_get_wm_normal_hints
> xcb_get_wm_hints
> xcb_get_wm_protocols
> 
> So I would like to add cookies and replies types.

Sounds like a plan.

> The 3 first functions can obviously use the same cookie
> and reply type names.

The names are fine.  Since they're all property requests,
you're going to have to figure out how to factor them.
xcb_get_text_property() in this file should probably move
into the property library somehow.

> The 5th function is using the 4th.

Factoring get_wm_size_hints() seems hard.  get_wm_normal_hints()
seems easy, since as you say it's just a wrapper.

Aren't you want to going to want to factor the _set_
functions also, to provide checked versions?

> In the last function, there is even a round trip as an
> atom is created.

Pretty clearly this atom should be interned only on the
first call; I'm not sure whether intern_atom_fast() takes a
round trip.

> So I would like to have your opinions about all thoses
> names, the functions to add or rename, etc...

In general, it's probably best to start with an
implementation of an idea Sri worked on a while back:
getting an asynchronous implementation of property tracking
using PROPERTY_CHANGE_NOTIFY events.  The basic idea is to
provide a version of the property library with a separate
thread.  You register a property for tracking, and the
background thread asynchronously does a get_property_value()
whenever a PROPERTY_CHANGE_NOTIFY event is received for the
property.  This way it's zero-latency, in most cases, to
read the property value.

The code's a bit tricky to write.  But once you've got it,
most of the stuff in icccm.c can be done without any round
trips...

    Bart


More information about the Xcb mailing list