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

Jochen Keil jochen.keil at gmail.com
Tue Jan 28 15:04:18 PST 2014


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,
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,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20140129/a2765bb0/attachment.pgp>

More information about the Xcb mailing list