[Xcb] Re: using xcb in existing apps

Barton C Massey bart at cs.pdx.edu
Fri Mar 2 11:55:23 PST 2007


In message <Pine.LNX.4.44.0703021238040.27678-100000 at groucho.unet.brandeis.edu> you wrote:
> On Fri, 2 Mar 2007, Ted X Toth wrote:
> 
> > Xavier Toth wrote:
> > > I want to use xcb in an existing app is there a function that returns
> > > a xcb_window_t when supplied a Window created  by XCreateWindow?
> > >
> > I probably should have asked how I can use the same connection for Xlib 
> > and XCB functions?
> > _______________________________________________
> > xorg mailing list
> > xorg at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/xorg
> > 
> 
> Hi Xavier,
> 
> XCB questions should be directed to the xcb mailing list: 
> xcb at lists.freedesktop.org.
> 
> You probably shouldn't be mixing xlib and xcb functions within the same 
> program.  You also can't really convert types between the two without some 
> pain.
> 
> There is a function XGetXCBConnection with the newer libX11 that will give 
> you an xcb_connection_t but as far as I know only mesa uses it.

Jeremy is being a bit conservative.  One of the explicit
features of Xlib/XCB is the ability to mix Xlib and XCB
calls for experimenting and porting.  Use as you will.

As Jeremy and Ian rightly say, you need Xlib/XCB, so that
you have XGetXCBConnection().  Call it and get the
XCBConnection back and go nuts with it.  You should be able
to freely mix XCB and Xlib calls.

The only trick I remember here is who owns the event queue.
Xlib owns it by default, meaning that XCB event processing
functions won't work.  There's some function you can call
before setup to change this, though I don't remember offhand
what it's called.  The default is normally what you want in
this case anyhow.

    Bart


More information about the Xcb mailing list