[Xcb] Questions about the X protocol and the XCB implementation

Bart Massey bart at cs.pdx.edu
Tue Jan 28 21:19:07 PST 2014

You could try to get XCB to writev() your C++ data structure for you
to avoid the copy, but it would be a non-trivial amount of work. It
would probably involve using the binding generator to build a special
C++ XCB binding that took various C++ data structures into account.
Doable, perhaps, but probably not worth the immense effort. --Bart

On Tue, Jan 28, 2014 at 3:04 PM, Jochen Keil <jochen.keil at gmail.com> wrote:
> Hello,
> currently I'm trying to understand the X protocol and the XCB
> implementation better. My first question about the X protocol would be
> if there is something like a picture or so which describes the
> (byte-wise) layout of a request/event/etc. packet.
> Maybe similar to what exists for the TCP/IP packets. Or is this
> a misconception of mine?
> Secondly I've looked a bit at the XCB implementation, starting from
> a generated request (xcb_change_property) to the stubs. If I understood
> it correctly, the request function calls xcb_send_request ->
> send_request -> _xcb_out_send -> _xcb_conn_wait -> write_vec.
> write_vec finally send()s the data over the socket.
> Now, if I have a (high-level) container like a C++ map, I would have to
> transform (copy) the values to an array first, which then gets copied
> again by memcpy in send_request().
> I figured, that it would be good if the values from the container could
> be written directly to the socket. E.g.:
> for (k, v in map) { send(c-fd, &v, sizeof(v)); }
> Now I'd like to know if this makes sense at all and if I could implement
> this easily by (re-)using the existing implementation.
> My biggest problem is to understand what xcb_send_request does. Could
> I just send a request "head" (e.g. for change_property: mode, window,
> property,
> type, format) followed by the data in separate send() calls?
> I hope I expressed my ideas clearly enough. Please ask, if I should go
> more into detail about something. I also appreciate any critique!
> Thank you,
> Jochen
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb

More information about the Xcb mailing list