[Xcb] Initialisation of GC etc.

Peter Harris peter.harris at hummingbird.com
Mon Mar 31 09:18:43 PDT 2008

Maciej Piechotka wrote:
> I have a question:
> xcb_gcontext_t gc = xcb_generate_id(conn);
> xcb_void_cookie_t cookie = xcb_create_gc(conn, gc, window, ...);

Actually, you need to call xcb_create_gc_checked if you want an error 
checking cookie, since create_gc doesn't normally have a reply.

Normally, you would just call xcb_create_gc without saving the cookie.

> // 1
> // Do something with gc
> 1. Do I have to wait/flush connection before I use gc?


> 2. Can I wait for confirmation of creation?

If you really want to.

You don't usually want to, however, as the GC will only fail to be 
created if you passed invalid arguments to create_gc, or if the X server 
is out of memory (in which case, you can't do much of anything anyway).

> 3. Can I check if it was created without blocking?

No. If you need a response from the X server, you will have to wait 
(block) until the response arrives.

Peter Harris
      Hummingbird Connectivity - A Division of Open Text
Peter Harris                    http://connectivity.hummingbird.com
Research and Development        Phone: +1 905 762 6001
peter.harris at hummingbird.com    Toll Free: 1 877 359 4866

More information about the Xcb mailing list