[Xcb] language bindings for xcb

a r nbs.public at gmail.com
Sun Jun 3 03:51:30 PDT 2007


On 6/1/07, Thomas Hunger <hto at arcor.de> wrote:
>
> > >>> import xcb
> > >>> import render
> > >>> c = xcb.Connection()
> > >>> win = c.generate_id()
> > >>> r = c.get_render_extension() # new method, checking whether
> > >>> render ext. exists
> > >>> r.create_picture(...) # no need to add 'c' explicitly since it
>
> This does not really solve the problem because c would need to have a
> "get_render_extension" function right from the start. Which means that I
> need to program all possible extensions into the basic connection object.

Right, how about adding a generic function then?

r = c.get_extension("render")

In this case you should derive a "Render" class from a generic
"Extension" class, what is a good idea anyway.

> If I just tourn your example around, e.g.
>
> >>> import render
> >>> r = render.from_connection(c)

That's also a good idea. I am not sure whether it makes sense to
create a Render object without associating it with a connection. If
not, instead of adding a new function you can just modify the Render's
constructor to make it accept a connection parameter. Then you can
write it more naturally:

>>> import render
>>> r = render.Render(c)

As before, I would recommend to add a base class for all extension classes.

> It would solve the problem. So: thanks a lot!

You're welcome. I am looking forward to see your wrapper.

\R.


More information about the Xcb mailing list